Skip to content

Instantly share code, notes, and snippets.

@stream7
Created July 5, 2011 13:24
Show Gist options
  • Save stream7/1064825 to your computer and use it in GitHub Desktop.
Save stream7/1064825 to your computer and use it in GitHub Desktop.
SQL logs from activerecord in rails console
For Rails 2:
ActiveRecord::Base.connection.instance_variable_set :@logger, Logger.new(STDOUT)
For Rails 3:
ActiveRecord::Base.logger = Logger.new(STDOUT)
taken form http://stackoverflow.com/questions/1344232/how-can-i-see-the-sql-that-will-be-generated-by-a-given-activerecord-query-in-rub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment