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