My form_for example works correctly, but *WHY* does it work?

Hello,

I am still new to Rails and have been trying to understand forms and form_for, but it seems there are a number of ways to do / specify things that all work fine. For example, I created this simple example that works exactly how it should:

http://pastie.caboo.se/75110

My questions are:

- I see many people do <% form_for :category, @category ... %>, whereas I did just <% form_for :category .. %>. Someone said this would be so the @category instance variable would be available to prepopulate the form on validation, but my example successfully prepopulates the form just fine on validation without the addition of @category. Why?

- Doing :object => f causes us to use the 'form' object when specifying methods like form.text_field. Where did 'form' come from? I noticed I can achieve the same thing doing :locals => { :f => f } and then using f.text_field in the helper.

Thanks for the help in understanding this.

Some Browsers (e.g. FF) Save form data when you go back&forth in browser history. Taht may be it. Test it in IE and i my guess is that it won't work there :wink:

rob schrieb: