id
とquantity
の値を、params
のPOSTフォームでサブミットして取得したいとします。Ruby On Rails:POSTリクエストからネストされたパラメータを抽出する方法
パラメータ:
params
# => {...
"form"=>
{"name"=>"joe",
"date_sent"=>"09/28/2016",
"emp_num"=>"54552452",
"items_attributes"=>{"1474227471986"=>{"id"=>"3", "quantity"=>"5", "_destroy"=>"false"}, "1474227474062"=>{"id"=>"4", "quantity"=>"3", "_destroy"=>"false"}},
"comments"=>"af",
"accepted"=>"false"},
"commit"=>"Submit",
"m"=>"true"}
あなたはどのようなコードを持っていますか?ネストされたハッシュは、Rubyの基本的な機能です。 –