Created
August 18, 2011 08:14
-
-
Save marcgg/1153638 to your computer and use it in GitHub Desktop.
Display SQL log to the Rails console in 2.x
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') | |
# log SQL to the Rails console | |
Object.const_set('RAILS_DEFAULT_LOGGER', Logger.new(STDOUT)) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Credit goes to http://www.snippetstash.com/public/127