Variable dumper

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Variable dumper

Ezra Nugroho
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

--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Rails mailing list
[hidden email]
http://lists.rubyonrails.org/mailman/listinfo/rails
Reply | Threaded
Open this post in threaded view
|

Re: Variable dumper

Ezra Zygmuntowicz

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

> 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
>
> --  
>


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 Zygmuntowicz
WebMaster
Yakima Herald-Republic Newspaper
[hidden email]
509-577-7732
_______________________________________________
Rails mailing list
[hidden email]
http://lists.rubyonrails.org/mailman/listinfo/rails
Reply | Threaded
Open this post in threaded view
|

Re: Variable dumper

Ezra Nugroho
> 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 Zygmuntowicz

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


--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Rails mailing list
[hidden email]
http://lists.rubyonrails.org/mailman/listinfo/rails