I'm still hazy on what is the first parameter for form_for
or form_tag
and which one to use when. But basically I'm building a website where visitors can post concert events to the site. Event is a model. The admin can see a list of submitted events and I want each one to have a check box and then the admin can check which events he wants to approve and hit submit on the form and they all get updated. :approved
is a boolean field in the Event model.
I've read this post but am not sure where they get the first parameter in for form_tag
in the next to last answer.
I figured I need a new controller called EventsUpdateController. So far I have something like this but it's not quite right:
<%= form_tag events_update_path do %>
<% @unapproved_events.each do |event| %>
<%= fields_for "events[]", event do |e| %>
<tr>
<td><%= e.check_box :approved %></td>
<td><%= event.date.strftime('%A %B %-d') %></td>
<td><%= event.time.strftime('%l:%M %P') %></td>
<td><%= event.title %></td>
</tr>
<% end %>
<% end %>
<% end %>