I am building an admin section for an app I’m working that lists businesses. Admins can then go in and submit an email address and activate the business. So I am using a form_tag within a block like so:
<% for business in @businesses %>
<tr>
<td align="center" class="border-table"><%= business.id %></td>
<td align="center" class="border-table"><%= business.name %></td>
<td align="center" class="border-table"><%= business.address %></td>
<td align="center" class="border-table"><%= business.phone %></td>
<% @user = User.new %>
<%= form_tag "/businesses/activate?business_id=#{business.id}", :remote => true, :method => :put do %>
<td align="center" class="border-table" id="<%= business.id %>_email"><%= text_field_tag "email", nil, :placeholder => "email" %></td>
<td align="center" class="border-table" id="<%= business.id %>_activate"><%= submit_tag "Activate" %></td>
<% end %>
</tr>
<% end %>
So on a given admin page there are 25 of these forms, one for each row in the table.
The problem is, for whatever reason, the “email” param is not getting posted, just the business_id (from the path).
Is there something I am doing wrong? Are you not supposed to generate multiple similar forms using a block?
Any advice would be much appreciated.
Thanks!
i figured it out. it seems most browsers won’t pass the params of a form unless it’s inside the
<td>like so: