0
では利用できない属性。 request.raw_post
から、属性がPOST要求に含まれていることがわかりますが、params
には入りません。私はpermit
の属性を成功させようとしました。Railsの5 RC1 - POSTは、私は新しい投票レコードを作成するために、Railsの5 RC1 APIにPOSTリクエストを送信していますのparams
# article_votes_controller.rb
def article_vote_params
logger.debug "### hello from the params function"
logger.debug request.raw_post
params.permit(:user_id, :user_type, :article_id, :article_type)
logger.debug params.inspect
logger.debug params.to_unsafe_h
end
上記のコードは、次のように出力されます。
### hello from the params function
{"user_id":"1","user_type":"User","article_id":"99","article_type":"Article"}
<ActionController::Parameters {"controller"=>"article_votes", "action"=>"create"} permitted: true>
{"controller"=>"article_votes", "action"=>"create"}
はなぜ要求に含まれる属性はparams
に含まれていないでしょうか?