How to sanitize grape params
Posted
by
Boti
on Stack Overflow
See other posts from Stack Overflow
or by Boti
Published on 2014-05-30T14:02:44Z
Indexed on
2014/05/30
15:27 UTC
Read the original article
Hit count: 361
I want to mass update attributes of an entity.
How can I sanitize properly the params which is coming from grape?
This is my console log about the parameters:
params.except(:route_info, :token, :id)
=> {"display_number"=>"7"}
[18] pry(#<Grape::Endpoint>)> params.permit(:display_number)
ArgumentError: wrong number of arguments (2 for 0..1)
from /Users/boti/.rvm/gems/ruby-2.0.0-p353@thelocker/gems/hashie-2.0.5/lib/hashie/mash.rb:207:in `default'
[19] pry(#<Grape::Endpoint>)> params.sanitize
=> nil
© Stack Overflow or respective owner