Display ActiveRecord sql queries in irb console

If you want to see all the queries that ActiveRecord executes when you run a ruby script in irb add the following lines:

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

Another options for logger level are:
DEBUG, INFO, WARN, ERROR, FATAL, UNKNOWN

Advertisements