I have a form\_tag with a radio\_button\_tag and it populates with data from DB. It must simply be directed to a customised update action(update\_multiple) where a boolean column is updated for all those 2 records which have been changed in the form.

For e.g. say when initially the form was populated from DB with record 1's radio button selected and now user changed his selection to record 3, then at Submit of form tag the update of both records must occur but the problem is the code at submit, only collects id of record which is now selected in that group.How do I get id of that record also which was unselected so that I can update\_all for both of them at one go?

And if Submit cannot handle this action, then is there a way in controller or form to persist the id of the initial selected record before populating the form? As you see, I've tried with collecting an array of ids[] with radio\_button\_tag.

TIA for your help.

Here's the form code:

```
<%= form_tag update_multiple_user_cv_attachments_path, method: :put, action: :update_multiple do %>
      <table class="table table-bordered table-striped">
        <thead>
          <tr>
            <th> Select a CV </th>
            <th> Resume Name </th>
          </tr>
        </thead>
        <tbody>
        <% @cv_attachments.each do |cv_attachment| %>
        <%= hidden_field_tag cv_attachment.main, :value => params[:main] %>
          <tr>
            <td><%= radio_button_tag "cv_attachment_ids[]", cv_attachment.id, cv_attachment.main %> </td>
            <td><%= cv_attachment.attachment.file.basename %></td>
          </tr>
        <% end %>
        </tbody>
      </table>
      <br>
      <%= submit_tag "Select Main", :class =>'button' %>
     <% end %>

```

Here's the controller update\_multiple code.

```
def update_multiple
CvAttachment.update_all(["updated_at=?", Time.now], :id => params[:cv_attachment_ids])

```

end