I’d like to debug a variable @num in my Rails controller, so I’m evaluating
<%= @num %>
in my Rails view. However, I cannot distinguish between @num being '', ' ', and ' ' (and other different types of whitespace) when it’s printed in the HTML. Is there any way to print it out clearly?
If you want to be really sure:
When
@num = ' 'this should render:#inspectis great when you want to a representation of some object as a string.If this is a complex object or large array or deep hash, I often prefer
#to_yamlfor inspection which lays it out in a somewhat readable format.