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:
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.