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
Then open your ~/.irbrc file and add these lines to it.
usually if you use RVM and ruby 1.9.3 your path to awesome_print gem will be like
now fire up your rails console and try to print any object prepended with ‘ap’
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.
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 !!!