Rails Console Shortcuts

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.