← til

Debugging ActiveRecord queries in a Rails console

January 19, 2012
rails

I'm going to share a command that comes in very handy when debugging ActiveRecord queries. With it you can see the SQL queries generated by any method. It's very useful when debugging your application in a console.

Here it is:

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