I want to be able to change a property on multiple records in my app. I thought about adding a checkbox so that one can pick which records to update. The question is how to implement the actual update - if the checkbox isn't part of the model, how can I iterate the records in the view and see which are selected? My records are displayed using a partial:
# _product.html.erb
<%= check_box_tag 'modify' %> <%=h product.name %> <%=h product.price %>
# index.html.erb
<% form_tag %>
<%= text_field_tag 'price' %> <%= render :partial => 'product', @collection => @products %> <%= submit_tag 'save' %>
<% end %>
Also, what kind of form should I put this in, and how to catch which boxes are selected... I'm pretty clueless about this - thanks.