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)

Like this post? Follow @shimewastaken on Twitter for more content like this.
Written by

Hrvoje Šimić