Flowdock

Notes posted by rafaelkin

RSS feed
July 20, 2012
0 thanks

Set ids when using a collection of values (cont.)

Regarding schmidt’s post.

The following will not have the expected behavior:

<% Car.each do |c| %>
  <%= check_box_tag "car_ids[]", c.id, :id => "car_ids_#{c.id}" %>
<% end %>

But, if you put the “checked” option to false (or true), it will.

<% Car.each do |c| %>
  <%= check_box_tag "car_ids[]", c.id, false, :id => "car_ids_#{c.id}" %>
<% end %>