aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorOlivier Lacan <hi@olivierlacan.com>2018-01-12 15:50:50 +0100
committerOlivier Lacan <hi@olivierlacan.com>2018-01-23 16:21:13 +0100
commit1044e8b355930e8cb14d1f182d33a561fdaca65b (patch)
treeb1c9e42a3633651cfa7905326b23001768942e5a /activerecord
parent0f7d3b612cc9264a90a1da6820d442099d8641f8 (diff)
downloadrails-1044e8b355930e8cb14d1f182d33a561fdaca65b.tar.gz
rails-1044e8b355930e8cb14d1f182d33a561fdaca65b.tar.bz2
rails-1044e8b355930e8cb14d1f182d33a561fdaca65b.zip
Disable verbose_query_logs in Rails Console
Should fix #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.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/railtie.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/railtie.rb b/activerecord/lib/active_record/railtie.rb
index 4538ed6a5f..9c580a6116 100644
--- a/activerecord/lib/active_record/railtie.rb
+++ b/activerecord/lib/active_record/railtie.rb
@@ -59,6 +59,7 @@ module ActiveRecord
console = ActiveSupport::Logger.new(STDERR)
Rails.logger.extend ActiveSupport::Logger.broadcast console
end
+ ActiveRecord::Base.verbose_query_logs = false
end
runner do