Notes posted by greeneggs614
RSS feed
1 thank
Set ids when using a collection of values
The trick to getting the helper to populate a unique HTML ID and for rails to recognise a collection is to give the helper a unique ‘name’ and to set the :name symbol to parameter with an array symbol ‘[]’.
<% Cars.each do |c| %> <%= check_box_tag "car_ids[#{c.id}]", c.id, :name => "car_ids[]" %> <% end %>