aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/explain.rb
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2012-01-26 02:50:46 -0800
committerXavier Noria <fxn@hashref.com>2012-01-26 02:51:18 -0800
commit24834606c2c41c362ea10b8ae35b45aaffd9c483 (patch)
tree74146880de1e50d8b8bfe04e3d4edf22fb492865 /activerecord/lib/active_record/explain.rb
parent3a087b8b5e3da3f8cf5a68b6bd354497810bbbd9 (diff)
downloadrails-24834606c2c41c362ea10b8ae35b45aaffd9c483.tar.gz
rails-24834606c2c41c362ea10b8ae35b45aaffd9c483.tar.bz2
rails-24834606c2c41c362ea10b8ae35b45aaffd9c483.zip
disable automatic explain if there is no logger [closes #4671]
Diffstat (limited to 'activerecord/lib/active_record/explain.rb')
-rw-r--r--activerecord/lib/active_record/explain.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/explain.rb b/activerecord/lib/active_record/explain.rb
index b64390250d..bdccf535ea 100644
--- a/activerecord/lib/active_record/explain.rb
+++ b/activerecord/lib/active_record/explain.rb
@@ -22,6 +22,8 @@ module ActiveRecord
# currently collected. A false value indicates collecting is turned
# off. Otherwise it is an array of queries.
def logging_query_plan # :nodoc:
+ return yield unless logger
+
threshold = auto_explain_threshold_in_seconds
current = Thread.current
if threshold && current[:available_queries_for_explain].nil?