Rails

PHP's var_dump equivalent in Ruby on Rails

roland's picture

The PHP function var_dump is a very important tool for web developers as it allows one to inspect the variables of an object, or show the elements in arrays. In Coldfusion, the equivalent of var_dump is the cfdump tag.

Rails inherits has Ruby's inspect function for all variables, but sometimes it is rather useless if you are looking at big arrays. Here's an alternative:

<%= content_tag("pre", YAML::dump(var_name)) %>

Syndicate content