Greetings!

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.


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

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


list.html.erb
Code:
<%= form_tag update_multiple_store_owner_leads_path, :method => :put do %>

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

<%= 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:

Code:
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'
Request

Parameters:

{"commit"=>"Save Targeted Leads",
 "lead_ids"=>{"6"=>{"selected"=>"1"},
 "1"=>{"selected"=>"0"},
 "3"=>{"selected"=>"0"}},
 "authenticity_token"=>"ALYtIkJNsAANsHXaAvgeb84G9Ms7OPSkyFO6jkM19yU=",
 "_method"=>"put",
 "utf8"=>"\342\234\223"}
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.