Strong Params and Arrays of Values

February 12, 2016

The Strong Parameters #permit method only allows permitted scalar values by default. See the documentation on permitted scalar values.

Here’s the important bit that I always forget:

To declare that the value in params must be an array of permitted scalar values map the key to an empty array:

params.permit(:id => [])

Tags: rails
comments powered by Disqus