Useful tricks with script/console

Posted by Hosh Wed, 01 Aug 2007 11:43:00 GMT

One of my favorite tools for Rails is script/console. It lets me test out snippets of code to make sure things work the way they are supposed to work. I found two useful things this morning:

Tab completion

Tab completion works in script/console.

script/console
user = User.find :first
user.up[tab]

You have no idea how happy that makes me.

reload!

After I found out about tab completion, I found myself making some heavy code changes, and testing them out in the console. I kept having to quit and restart the console. Out on a lark, I hit 'r' and hit tab ... and found 'reload!'. I always wanted that command, but I had thought it was 'reload' not 'reload!'. Go figure.

Comments

Leave a response

Comments