Tuesday, March 16, 2010

Always turn on ActiveRecord logging in the console

Remember that you can turn on ActiveRecord logging for the console and see what SQL-query is executed?
Here’s a statement you can put in your environment.rb file (or in one specific environment config file - such as development.rb) to have it turned on permanently:
if "irb" == $0
ActiveRecord::Base.logger = Logger.new(STDOUT)
end
http://weblog.jamisbuck.org/2007/1/8/watching-activerecord-do-it-s-thing#comment-1266

No comments: