我将 JSON 数据发送到解析它的控制器。
ROR 代码
Class.where(challenge_id:challenge.id,song_id:song_hash['song_id']).first
错误是_
can't convert String into Integer
我什至将其更改song_id:song_hash['song_id']
为song_id:song_hash['song_id'].to_i
但没有用
哈希数据是
{"session_token"=>"Xt9toEzHI3bYXeJNkenyqg", "challenge"=>{"challenge_id"=>"15", "player_name"=>"usman", "guessed_songs"=>{"0"=>{"song_id"=>"10", "guessed"=>"YES"}, "1"=>{"song_id"=>"11", "guessed"=>"YES"}, "2"=>{"song_id"=>"12", "guessed"=>"YES"}, "3"=>{"song_id"=>"13", "guessed"=>"YES"}, "4"=>{"song_id"=>"15", "guessed"=>"YES"}}, "player_status"=>{"0"=>{"coins"=>"20", "points"=>"0", "player_name"=>"usman"}, "1"=>{"coins"=>"20", "points"=>"0", "player_name"=>"Usman"}}}}
找不到未转换为整数的内容