aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
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:50:46 -0800
commitf251437415f7b803f7a84118fcc970a111ace266 (patch)
treec4a86b401027742fe78ab6087af8ed91eb53c280 /activerecord/lib/active_record
parentd11347df7203cb5c82caad5c9949830980e3eb6a (diff)
downloadrails-f251437415f7b803f7a84118fcc970a111ace266.tar.gz
rails-f251437415f7b803f7a84118fcc970a111ace266.tar.bz2
rails-f251437415f7b803f7a84118fcc970a111ace266.zip
disable automatic explain if there is no logger [closes #4671]
Diffstat (limited to 'activerecord/lib/active_record')
-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 e502d7e52b..01cacf6153 100644
--- a/activerecord/lib/active_record/explain.rb
+++ b/activerecord/lib/active_record/explain.rb
@@ -19,6 +19,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?