On here:

http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-check_box-label-Gotcha

you see this code:

<%= fields_for "project[invoice_attributes][]", invoice, :index => nil
do |form| %>
  <%= form.check_box :paid %>
  ...
<% end %>


why are they using :index => nil in the example? I mean I know that
what it does is ensure that the invoice objects do not get passed an
index number so that you have this: project[invoice_attributes][]
rather than this: project[invoice_attributes][1]. But why in the above
example, do they want to achieve this? It seems as though invoice is
an existing object and therefore is not a new record.

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to