pretty print on Rails: undefined method 'pp'?
24 Aug 2007
Knowledge
I was a PHP programmer before, I got used to 'echo' when trying to debug PHP application. That's why when migrating to Ruby from PHP, I used pp a lot. Although it just prints to console, it helps a lot.
But I've been wondering all this while, sometimes I got an application error,undefined method 'pp'
while trying to pretty-print an object on Rails.
I never bothered to find out why, until today where I just happen to.
It turns out we have torequire 'PP'
on our code to make it works. Duh!
And make sure you use lowercase 'pp' if you are in a linux environment, otherwise it will sayNo such file to load
