ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> rubyonrails-talk
rubyonrails-talk
[Rails] My form_for example works correctly, but *WHY* does it work?
by Rob other posts by this author
Jun 30 2007 7:35PM messages near this date
[Rails] Re: Save as document that can open in msword or openoffice | [Rails] Re: 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.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Ta
lk" group.
To post to this group, send email to rubyonrails-talk@[...].com
To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@[...].com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Thread:
Rob
Thorsten

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved