Reputation: 315
So I have this:
<%= select("selected_red1_robot", "id", @robots.map { |u| [u.team_number,u.id]}) %>
when I do in my controller I see this:
params['selected_red1_robot']
and I see this in my return:
"selected_red1_robot"=>{"id"=>"2"}
I want to do something like:
@roboMatch.robot_id = params['selected_red1_robot']
What am I missing here?
Upvotes: 1
Views: 549
Reputation: 2343
You're close to the id, you just need to reference it as follows:
@roboMatch.robot_id = params['selected_red1_robot']['id']
Upvotes: 1