I'm trying to update one field of multiple records in a model, "Lead". Each lead is displayed in a table row, and the field being modified for the multiple rows is "selected", which is a boolean, stored as tinyint 1 or 0, true or false.

  def list
    @leads = Lead.where({:store_number => session[:store_number]}).order("selected DESC")
    @targeted_leads = Lead.where(:store_number => session[:store_number], :selected => true)

  def update_multiple
    @leads = Lead.find(params[:lead_ids])
    redirect_to(:action => 'list')

<%= form_tag update_multiple_store_owner_leads_path, :method => :put do %>

			<th>Lead Name</th>
			<th>Selected Leads</th>
	<% for lead in @leads %>
			<td><%= lead.company_name %></td>
				<%= fields_for("lead_ids[]", lead) do |f| %>
					<%= f.check_box("selected") %>
				<% end %>
	<% end %>

<%= submit_tag('Save Targeted Leads', :class => "btn") %>

<% end %>

Now, what I want this form to do is pass all leads through, and if checked, update that record's "selected" field to 1, and if unchecked, update the field to 0.

When it passes along, here are the results on the update_multiple action:

ArgumentError in LeadsController#update_multiple

Unknown key: 6
Rails.root: (my/rails/root)

Application Trace | Framework Trace | Full Trace
app/controllers/store_owner/leads_controller.rb:73:in `update_multiple'


{"commit"=>"Save Targeted Leads",
FYI: (Line 73 references this row in my controller: @leads = Lead.find(params[:lead_ids]) )

When I look at this, it looks like it's passing everything along, just as I'd want it to... Lead Model, take id 6, set selected to 1. Now take id 1, set selected to 0. What's really confusing me is that "Unknown key" bit.

My initial thoughts are, it's not looking for the right field to modify... as in, it knows I'm looking for "6", but what about "6"? "6" is not a key. Id 6, or something else?

Has anyone else solved this? Thank you in advance for your thoughts.