Open MrJoy opened 7 years ago
@MrJoy @CentroDL @ndbroadbent may be the last 2 commits in my from are doing what you expected (somehow)
Thanks @obourdon, this would be great to merge in! I’m always getting this error while debugging a controller action and trying to see the params.
I honestly don't even remember this issue -- and am no longer at the organization that was experiencing it. That said, your changes certainly look like they would help. Thank you!
@obourdon I think that here:
https://github.com/obourdon/awesome_print/commit/5567d544b9c83a29b9e889d38a9c37cbe994480e
you would want to be able to call object.to_enum.to_h
which is what will turn the Parameters to a hash. but then you lose out on the permitted:true
attribute. 🤔
Unfortunately, for historical reasons, our Rails app has some data serialized to a
text
column nameddata
as YAML that includes a class ofActionController::Parameters
, and adef data
method that does aYAML.load
of the raw attribute.When we try to display the offending model at the console, we get the above and no other output. No useful stack trace, no meaningful info about the object, etc. The
inspect
method for the model works fine, because it's displaying the column attribute (I.E. aString
), not the parsed YAML.While this is a pathological design problem on our end, the failure mode of not displaying anything is an impediment to debugging.
Perhaps you could catch exceptions, and try falling back to
inspect
? Or maybe provide more context about what went wrong (I.E. the path into the object at which the exception occurred)?Or, perhaps propagate the error in a way where Pry's
_ex_
is properly set?