خرید بک لینک

Vote count: 0

I'm sending a POST request to a Rails 5 RC1 api to create a new vote record. I can see from request.raw_post that the attributes are included in the POST request, but they do not make it into params. I've attempted to permit the attributes with no success.

# 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

The above code gives the following output.

### 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"}

Why wouldn't attributes that are included in the request be included in params?

asked 2 mins ago

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 22 ارديبهشت 1395 ساعت: 2:44

صفحه بندی