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?

2 Answers 2

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

Sign up to request clarification or add additional context in comments.

1 Comment

Pry does not use .irbrc it uses .pryrc
5

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.