How to debug a varible/collection/array


is there any function in ruby like print_r in php.

i want to debug variable/collection/session array in browser.

if i use puts it give nothing

to_yaml (as in myArray.to_yaml) works for most needs.

it does not print anything in browser
i am using it like:
in rhtml

what to do :frowning:

Try this in your view.

<%= @job.to_yaml %>
<%= session.to_yaml %>

Or use the logger from the controller (my favorite approach) like this

logger.debug @job.to_yaml

Then just check the development log for the YAML version of the array.