From 15fbf5b58be386c8c5c02b06a4069c23cbcd5f0f Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Sat, 24 Dec 2011 00:46:30 +0000 Subject: auto_explain_threshold_in_seconds should be a global config option so it can be shared between AR::Base and AR::Model --- activerecord/lib/active_record/explain.rb | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'activerecord') 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 -- cgit v1.2.3