Вопрос

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?

Это было полезно?

Решение

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

Другие советы

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...

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top