Rails Console Shortcuts

Posted by James Mead Fri, 22 Dec 2006 15:14:00 GMT

A couple of quick nuggets I picked up from Amy Hoy’s Secrets of the Rails Console Ninjas.

Firstly, the magic y method which dumps an object to YAML – much more readable than the standard inspect output.

>> y james
--- !ruby/object:User 
attributes: 
  firstname: James
  surname: Mead
  login: floehopper
new_record: true
=> nil

Secondly, clear your console using command + k (or ctrl + l for those on Windows)

Thanks Amy.

Tags , , ,  | no comments