In one form I am creating a territory and editing multiple users. The "user_attributes" below are for the users and the "name" is for the territory. So for each user_attribute I wanted to update the user model.
params
{ "territory"=>{"name"=>"Central Canada",
"user_attributes"=>[{"user_id"=>"30"},{"user_id"=>"30"}]}
}
create action
@territory = @current_account.territories.new[:territory]
params[:user_attributes].each do |item|
@user = User.find(item[:user_id])
@user.update_attribute(:territory_id, @territory.id)
end
But rails is kicking back that params[:user_attributes] is nil. But you can see from the params its not. Am I missing something??