Hirb - irb in tables form

I was randomly searching for documentation on writing tests for ActiveMerchant when I ended up on this article introducing Hirb, an irb addon which lets you view your objects in tables instead of a Hash form.

What's really neat is that Nicholas (the author of the aforementioned article) added a neat little tip to log SQL outputs onto your screen:

Simply by typing the following in your irb.

ActiveRecord::Base.connection.instance_variable_set :@logger, Logger.new(STDOUT)

Source: StackOverflow


This would really be helpful when dealing with lots of complex relationships, and gives you a clearer picture on how ActiveRecord is actually pushing SQL queries. For the SQL optimizers, this would also show you where in your code you should switch to manual querying.


Screenshot is taken from Nicholas' blog, but uploaded it to imageshack. Don't want to be rude by hotlinking to his server.

Check it out, Hirb is a pretty neat addon.

Hirb: Github