What is 'the rails way' to have a form with submit_tags for each row, where the submit_tag 'tells' the controller which row's submit was clicked?
Inside a form_tag, my form displays a list of users, and next to each user are several actions such as 'foo' and 'bar'.
Currently I use link_to for those actions, which adds a query param :row => this_row.guid
so my controller knows which row to take action on. It works, but I don't like having the query params exposed on the url, and I don't like how they persist on the URL so if the user clicks refresh it performs the action again.
Since the rows are displayed are inside a form already, I'd like to have each action be a submit_tag. But I do not see from the API docs that there is any way to add a different query param to each instance of a submit_tag.
When I try this:
= submit_tag "foo", {:row => this_row.guid}
= submit_tag "bar", {:row => this_row.guid}
The html DOES look like <input .... row='SOMEGUID' ...>
However the POSTed params do not include the :row query params
I also tried
= submit_tag "foo", params.merge(:row => this_row.guid)
= submit_tag "bar", params.merge(:row => this_row.guid)
with the same result ( includes the row=GUID, but that param is not POSted to the controller when the user clicks the submit button).
I'd appreciate any help on how to have many rows of submit buttons (with the same name visible to the user) also pass a row identfier to the controller.