Variable dumper


#1

Hi there,

I am newbie both in Ruby and in Rails. My experience is mostly PHP.
In PHP, there is a var_dump($mixed) function that dumps the object
$mixed to std_out. This is helpful to see the curent value of a
variable, of if it is an object, everything that is in the object.

Is there an equivalent methods in RoR?

Thanks,
Ezra


#2

On Dec 23, 2005, at 5:03 PM, Ezra Nugroho wrote:

Thanks,
Ezra

Hey Ezra-

If you want to get a look at your variables in any of your .rhtml

views you can do so like this:

<%= debug(@post) %>

replace @post with whatever you want to dump. This will pretty print
your data so you can see what’s going on.

Cheers-
-Ezra Z.
WebMaster
Yakima Herald-Republic Newspaper
removed_email_address@domain.invalid
509-577-7732


#3

Hey Ezra-

If you want to get a look at your variables in any of your .rhtml
views you can do so like this:

<%= debug(@post) %>

replace @post with whatever you want to dump. This will pretty print
your data so you can see what’s going on.

Cheers-
-Ezra Z.

Thanks Ezra! I know someone in this list is better than Ezra (this one
is me of course…).