aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-12-24 00:46:30 +0000
committerJon Leighton <j@jonathanleighton.com>2011-12-24 11:08:16 +0000
commit15fbf5b58be386c8c5c02b06a4069c23cbcd5f0f (patch)
tree5e6d7ab076baec13a5d9e027dc771e23d30b9d90 /activerecord
parent13945b06ccde6979b10fce6fe68312077593f124 (diff)
downloadrails-15fbf5b58be386c8c5c02b06a4069c23cbcd5f0f.tar.gz
rails-15fbf5b58be386c8c5c02b06a4069c23cbcd5f0f.tar.bz2
rails-15fbf5b58be386c8c5c02b06a4069c23cbcd5f0f.zip
auto_explain_threshold_in_seconds should be a global config option so it can be shared between AR::Base and AR::Model
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/explain.rb11
1 files changed, 3 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/explain.rb b/activerecord/lib/active_record/explain.rb
index b64390250d..b5a67afd88 100644
--- a/activerecord/lib/active_record/explain.rb
+++ b/activerecord/lib/active_record/explain.rb
@@ -2,14 +2,9 @@ require 'active_support/core_ext/class/attribute'
module ActiveRecord
module Explain
- def self.extended(base)
- base.class_eval do
- # If a query takes longer than these many seconds we log its query plan
- # automatically. nil disables this feature.
- class_attribute :auto_explain_threshold_in_seconds, :instance_writer => false
- self.auto_explain_threshold_in_seconds = nil
- end
- end
+ # If a query takes longer than these many seconds we log its query plan
+ # automatically. nil disables this feature.
+ Configuration.define :auto_explain_threshold_in_seconds
# If auto explain is enabled, this method triggers EXPLAIN logging for the
# queries triggered by the block if it takes more than the threshold as a