Wednesday, September 5, 2012

[Rails] :index option to form_for

I was looking in the Rails source code, and during the call to
form_for, it creates a new instance of FormBuilder and during the
initialization, it checks if the options hash contains an index:

@default_options = @options ? @options.slice(:index, :namespace) :
{}

When will the options hash to form_for ever contain an index? I'm not
sure why the options hash would ever contain an index (all the options
hash contains up to this point in the form_for call are the :html
options and :url option). If you look at line 1196 of form_helper.rb
from latest rails release on github, you'll see that exact line a
paste above:

https://github.com/rails/rails/blob/master/actionpack/lib/action_view/helpers/form_helper.rb

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate