I am creating a data entry form that allows a user to fill in multiple
rows
and save them all at once. In my controller, I create an array of
“person”
objects and pass it to the page. On the page, I have a text field like
so:
<%= text_field “person”, “name”, “index” => 1 %>
Note the “index” attribute, which sets the name and id correctly. I
would
like to do the same with a collection_select, but can’t seem to get it
to
work. Does anyone know if there is an elegant way to set the “index”
attribute of a collection_select? Something like:
Note the ?index? attribute, which sets the name and id correctly. I
would like to do the same with a collection_select, but can?t seem to
get it to work. Does anyone know if there is an elegant way to set the
?index? attribute of a collection_select? Something like: