I followed Railscast Episode 165 (revised) to the tee on how to edit and Update multiple records in one form. But when I submit my form to edit multiple records at the same time, I get:
ActiveModel::ForbiddenAttributesError
For this line:
product.update_attributes(params[:product].reject { |k,v| v.blank? })
Params:
Parameters:
{"utf8"=>"✓",
"_method"=>"put",
"authenticity_token"=>"g5C2siF5GcWfPxhph4utWn8JBs2JXEpIUBDO6OlFyQQ=",
"product_ids"=>["11142",
"11143"],
"product"=>{"user_id"=>"",
"allow_multi_users"=>"true",
"state_id"=>"",
"site"=>"",
"department"=>"",
"room"=>"",
"asset_type_id"=>"",
"asset_model_id"=>"",
"sync_with_jss"=>"",
"carrier_id"=>"",
"mobile_contract_req_date"=>"",
"mobile_contract_end_date"=>"",
"mobile_international_plan"=>"",
"mobile_tethering"=>"",
"mobile_account"=>""},
"commit"=>"Update"}`
Normally, I would think this is because I have not permitted an attribute in strong parameters. But this isn't a attribute, it's the params for the form that hold all the values.
This is for my Products.rb model so shouldn't it already accept params[:product]?
products_controller.rb
private
def product_params
params.require(:product).permit(:mobile_account, :mobile_international_plan, :mobile_tethering, :mobile_contract_end_date.. )
end
Using Rails 4.0.0