Monthly Archives: August 2010

Rails Console SQL Output

It is sometimes useful when in Rails Console to see the SQL produced when testing model relationships.

So you start up “Rails C” or for people on older versions of Rails “script/console”

First run this line:

ActiveRecord::Base.logger = Logger.new(STDOUT)

Lookup some record and you will see the SQL (If you are using a SQL database) that was produced:

Console
Console