Created
February 25, 2011 16:57
-
-
Save urfolomeus/844086 to your computer and use it in GitHub Desktop.
My irbrc
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
if ENV['RAILS_ENV'] | |
# Called after the irb session is initialized and Rails has been loaded | |
IRB.conf[:IRB_RC] = Proc.new do | |
#logger = Logger.new(STDOUT) | |
#ActiveRecord::Base.logger = logger | |
#ActiveRecord::Base.connection_pool.clear_reloadable_connections! | |
show_log | |
end | |
def show_log | |
change_log(STDOUT) | |
end | |
def hide_log | |
change_log(nil) | |
end | |
def change_log(stream, colorize=true) | |
ActiveRecord::Base.logger = ::Logger.new(stream) | |
ActiveRecord::Base.clear_all_connections! | |
ActiveRecord::Base.colorize_logging = colorize | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment