I’ve found (and stolen from others) a number of tricks over time to make life in IRB and the Rails console (which is just IRB…) a bit easier. Here are a few to start.

Saving an object to YAML

Periodically, I need to save an object in YAML form. This does the trick –

`echo "#{User.find(1).to_yaml}" > user.yml`

Explanation: The only real trick here is using the fact that enclosing the statement in backticks (`) tells IRB to treat this as a shell command.