Debugging: unable to convert unpermitted parameters to hash

When debugging controller messages, if you get this message when trying to print params using AwesomePrint:

unable to convert unpermitted parameters to hash

or type params in pry:

[1] (pry) #<API::V1::Draft::PhotoAttachmentsController>: 0> params
(pry) output error: #<ActionController::UnfilteredParameters: unable to convert unpermitted parameters to hash>

The fix is to call, within pry:

params.to_unsafe_h

And then you can see all the params passed to your controller.

Note, just trying to print params won’t give this error.

So puts params works.

BUT p params does not!