watching activerecord
April 15th, 2008 • Uncategorized
# This greatly helps learning what ActiveRecord does! # All credits go to Jamis Buck at # http://weblog.jamisbuck.org/2007/1/31/more-on-watching-activerecord # environment.rb def log_to(stream) ActiveRecord::Base.logger = Logger.new(stream) ActiveRecord::Base.clear_active_connections! end # in irb or script/console or environment.rb log_to(STDOUT) # or create new streams buffer = StringIO.new log_to(buffer) puts buffer.string