How to see the sql statements for rails commands

Just type the following command in your rails console to see the sql output of your rails commands

ActiveRecord::Base.logger =

NOTE: You will probably have to do this for every session.

To avoid that, add the following to your ~/.irbrc file


require 'rubygems' if ENV.include?('RAILS_ENV') && ENV["RAILS_ENV"] == 'development' ActiveRecord::Base.logger = end
Ryan Sukale

Ryan Sukale

Ryan is just a regular guy next door trying to manage his life and finances.

You may also like...