:index => nil

On here:

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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs