[Rails] Viewing all Properties and Methods?

Nickolay Kolev nmkolev at uni-bonn.de
Wed Feb 1 09:39:44 GMT 2006


>   How can I see all the properties (member variables) and methods   
> (functions) that are available for an object? Is there a function   
> similar to PHP's  var_dump in MySQL?

You can use the 'methods' and 'instance_variables' methods. :-)

obj.methods
obj.instance_variables

Or in a view <%= debug(obj) %> will give you a nicely formatted YAML  
style representation of the object.

--Nicky


More information about the Rails mailing list