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?
您接近ID,只需按如下所示引用它即可:
@roboMatch.robot_id = params['selected_red1_robot']['id']
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.