Reputation: 365
I have following index action in controller
def index
details = CustomerInfo.current
.for_user(params[:user])
.for_product(params[:product])
.for_area(params[:area])
.where(value: params.permit(:value))
render(json: details)
end
When i added permit in where
i started getting the error can't quote ActionController::Parameters
at render(json: details)
But if i not use permit .where(value: params[:value])
it works fine.
Upvotes: 1
Views: 3555
Reputation: 291
I don't think you are using permit as it's intended to be used.
params.permit
returns an instance of ActionController::Parameters
, hence the error you get. See here for the code.
permit
should be used to limit the attributes that can be updated through mass assignment.
Here's the relevant documentation for it: https://apidock.com/rails/ActionController/Parameters/permit http://guides.rubyonrails.org/action_controller_overview.html#strong-parameters
Upvotes: 2