Just discovered this pretty nifty gem that works very much like pretty_print but is awsomer. It works right out of the box as a gem in your rails console and is very handy while checking on objects.
Here is what it simply does:
$ ruby script/console
Loading development environment (Rails 2.3.4)
>> require 'ap'
=> []
>> ap User.first
#<User:0x10498f648> {
:id => 1,
:first_name => "Tinu",
:last_name => "Cleatus",
:address => "123 ABC Rd",
:city => "Cochin",
:state => "Kerala",
:zip_code => "123456",
:country => "India"
}
=> nil
Loading development environment (Rails 2.3.4)
>> require 'ap'
=> []
>> ap User.first
#<User:0x10498f648> {
:id => 1,
:first_name => "Tinu",
:last_name => "Cleatus",
:address => "123 ABC Rd",
:city => "Cochin",
:state => "Kerala",
:zip_code => "123456",
:country => "India"
}
=> nil
Basically pretty prints the object in a very clean way with pretty colors (in the Terminal).
Moreover, it supports a lot of other custom options. Head over to the GitHub page for more info.




