Become a Rails Ninja with IRB Hacks
For all you Rails developers tapping your fingers waiting for your pages to load so that your model changes appear - help is at hand in the form of the irb (interactive ruby) console - where you can interact with your rails app from a prompt.
Getting started with the Rails console is really easy and Amy Hoy, frequent author of getting-started guides wrote about her experiences starting up with irb. Want to start on the long road to ninja excellence? Have a good rummage through her excellent tips.
You already know all that stuff - no worries - because the good stuff is just starting. A number of developers have been crafting their own environments, building out a mixture of scripts and gems to create their ultimate environments. We've chosen some of the best to share with you - pick what you like and craft your own.
First we'll start with wirble. Wirble makes your irb colorful - enabling you to quickly see the output from your code. Enabling it is a simple 4 line hack - with the benefits starting right away.
Next are tips from Dr Nic. The good doctor has created a gem - what_methods - which enables you to run .what? on an object to find out more information about an item.
Finally is the ultimate shuriken. To truly be a ninja you should be familiar with these techniques - mapping your app, popping into vim (textmate examples exist elsewhere) and popping into the shell to run svn and shell commands - the shuriken is a fantastic tool for interacting with rails and ruby - and will turn you from a knight into a true ruby ninja.
Another cool irb trick I've seen (but never used) is using a Capistrano task to connect remotely and run an irb session. It's from 'err the blog', at the tail of this post: errtheblog.com/post/21
Gilad Bracha Aug 27, 2014