Created
May 4, 2011 07:08
-
-
Save dekart/954862 to your computer and use it in GitHub Desktop.
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
# Rails on-screen logging | |
def change_log(stream) | |
ActiveRecord::Base.logger = Logger.new(stream) | |
ActiveRecord::Base.clear_active_connections! | |
end | |
def show_log | |
change_log(STDOUT) | |
reload! | |
puts "SQL log enabled. All ActiveRecord classes were reloaded." | |
end | |
def hide_log | |
change_log(nil) | |
reload! | |
puts "SQL log disabled. All ActiveRecord classes were reloaded." | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment