Skip to content

Instantly share code, notes, and snippets.

@urfolomeus
Created February 25, 2011 16:57
Show Gist options
  • Save urfolomeus/844086 to your computer and use it in GitHub Desktop.
Save urfolomeus/844086 to your computer and use it in GitHub Desktop.
My irbrc
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