I want to conditionally add a check box to each object in a table, such that, a user can select multiple items. When the user click's submit - I want to change the state of the objects that were selected and update the table via ajax. I've looked at collection_check_boxes
but I'm not sure how I can implement it in this situation.
See below, the code I wish to modify - to include the check boxes on each line.
<% if @events != nil %>
<% @events.each do |event| %>
<tr>
<td><%= event.driver.name%></td>
<td><%= event.name%></td>
<td><%= event.drop_off? ? "Drop Off At" : "Pick Up From" %></td>
<td><%= event.location_name%></td>
<td><%= event.is_game ? "Game" : "Not Game(event, practice)" %></td>
<td><%= event.location_address %></td>
<td><%= event.date ? event.date.strftime("%A, %d %b %Y %l:%M %p") : "Please Enter Details on TeamSnap!"%></td>
</tr>
<% end %>
<% end %>
I'm a little confused as to how I may implement a form_for in this context...
Any ideas are hugely appreciated!
Thanks!
Aucun commentaire:
Enregistrer un commentaire