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)
Written by

Hrvoje Šimić

@shimetweets