Clear your messed up rails console - gem 'awesome_print'
Clearly everybody using rails will have this problem. When your model gets bigger and bigger, you will find it difficult to spot your attributes in the rails console. So let's clear this messed up console and format it a little bit. We have a gem called 'awesome_print'. Install it using
gem install awesome_print
Then open your ~/.irbrc file and add these lines to it.
# load libraries require 'rubygems' $LOAD_PATH << '/path/to/awesome_print-x.x.x/lib' require 'awesome_print'
usually if you use RVM and ruby 1.9.3 your path to awesome_print gem will be like
/home/username/.rvm/gems/ruby-1.9.3-p448/gems/awesome_print-x.x.x/lib
now fire up your rails console and try to print any object prepended with 'ap'
ap User.first
Hooray!!! We formatted the console. But wait, we missed something. Printing everything with 'ap' prepended seems inappropriate. So let's make awesome_print our default formatter. Now, open your ~/.irbrc again and add this line after requiring awesome_print.
AwesomePrint.irb!
Now you will be able to format everything you print beautifully. And you can add options to awesome print. See the documentation for more details.
Enjoy hacking !!!











