-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Turn off Active Record's verbose_query_logs when using the console #31688
Comments
Yep. That makes sense.
We also need to figure out how to clean that ugly ass absolute path. That’s really unnecessary. :-)
Update: Hmm. And it seems weird that this Message query would come from thor. Seems like a bug.
…On 12 January 2018 at 15:33:08, David Heinemeier Hansson ***@***.******@***.***)) wrote:
When interacting with Active Record in the console, the verbose_query_log setting adds a lot of noise:
irb(main):009:0> Topic.first.messages Topic Load (0.1ms) SELECT "topics".* FROM "topics" ORDER BY "topics"."id" ASC LIMIT $1 [["LIMIT", 1]] ↳ (irb):9 Message Load (0.3ms) SELECT "messages".* FROM "messages" WHERE "messages"."topic_id" = $1 LIMIT $2 [["topic_id", 1], ["LIMIT", 11]] ↳ /Users/david/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor/command.rb:27 => #<ActiveRecord::Associations::CollectionProxy []>
This feature should be turned off when using the console.
cc @olivierlacan(https://github.com/olivierlacan)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub(#31688), or mute the thread(https://github.com/notifications/unsubscribe-auth/AAEBnu6D1BSSHANz3ac4HepEzPhr25lYks5tJ20kgaJpZM4RcXqK).
|
olivierlacan
added a commit
to olivierlacan/rails
that referenced
this issue
Jan 23, 2018
Should fix rails#31688 unless someone can point me to a better way to achieve this goal. Essentially David's point was that verbose query logging when enabled in Rails console tends to make things very noisy. That's especially true if we display absolute paths to callsites which sadly is still the case when we detect a caller that isn't part of the Rails application — think gems. Discussed this with both @matthewd and @rafaelfranca and went back and forth between enabling if defined?(Rails::Server) or this implementation and this one makes more sense for now. Long term I think it'll make sense to let people override this default disabling in Rails Console because they might want to use the feature but for now it feels like the correct default behavior.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When interacting with Active Record in the console, the verbose_query_log setting adds a lot of noise:
This feature should be turned off when using the console.
cc @olivierlacan
The text was updated successfully, but these errors were encountered: