2

I'm using pry, and ActiveRecord queries from the console always print out their corresponding SQL statements. I don't want this behavior. Googling around I only see that this must be explicitly achieved by setting the ActiveRecord logger to standard out.

Is this the default behavior of pry or is it the result of something I set that I forgot about? And how can I stop it?

John Bachir
  • 22,495
  • 29
  • 154
  • 227

2 Answers2

6

Try looking for a .irbrc file in the project root or your home directory. You may see this or similar:

  ActiveRecord::Base.logger = Logger.new(STDOUT)

Sometimes this ends up in another script that gets included in .irbrc.

YMMV, but I really like having SQL logged to the console. To each his own...

zetetic
  • 47,184
  • 10
  • 111
  • 119
5

If you are using Rails 3.1+ this is now the default behaviour. Check here Disable Rails SQL logging in console

Community
  • 1
  • 1
Bradley Priest
  • 7,438
  • 1
  • 29
  • 33