Created
June 7, 2013 14:36
-
-
Save wongyouth/5729704 to your computer and use it in GitHub Desktop.
rails2 show sql log in console
This file contains 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
def change_log(stream) | |
ActiveRecord::Base.connection.instance_variable_set :@logger, Logger.new(stream) | |
#ActiveRecord::Base.logger = Logger.new(stream) | |
#ActiveRecord::Base.clear_active_connections! | |
end | |
def show_log | |
change_log(STDOUT) | |
end | |
def hide_log | |
change_log(nil) | |
end | |
show_log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment