Is there a print_r or var_dump equivalent in Ruby / Ruby on Rails?
The .inspect
method of any object should format is correctly for display, just do..
<%= theobject.inspect %>
The .methods
method may also be of use:
<%= theobject.methods.inspect %>
It may help to put that in <pre>
tags, depending on the data
In views:
include DebugHelper
...your code...
debug(object)
In controllers, models, and other code:
puts YAML::dump(object)
Source