Created
February 11, 2011 20:22
-
-
Save dsueiro/822951 to your computer and use it in GitHub Desktop.
Log sql to console both in Rails 2.3 and Rails 3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'logger' | |
| if ENV.include?('RAILS_ENV')&& | |
| !Object.const_defined?('RAILS_DEFAULT_LOGGER') | |
| Object.const_set('RAILS_DEFAULT_LOGGER', Logger.new(STDOUT)) | |
| else | |
| ActiveRecord::Base.logger = Logger.new(STDOUT) | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment