mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
AS::Concern is not really needed for AR::Explain
This commit is contained in:
parent
05316ba127
commit
0065f37826
3 changed files with 74 additions and 76 deletions
|
@ -699,7 +699,7 @@ module ActiveRecord #:nodoc:
|
|||
include Associations
|
||||
include IdentityMap
|
||||
include ActiveModel::SecurePassword
|
||||
include Explain
|
||||
extend Explain
|
||||
|
||||
# AutosaveAssociation needs to be included before Transactions, because we want
|
||||
# #save_with_autosave_associations to be wrapped inside a transaction.
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
require 'active_support/concern'
|
||||
require 'active_support/core_ext/class/attribute'
|
||||
|
||||
module ActiveRecord
|
||||
module Explain
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
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
|
||||
|
||||
module ClassMethods
|
||||
# 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
|
||||
# whole. That is, the threshold is not checked against each individual
|
||||
|
@ -81,5 +80,4 @@ module ActiveRecord
|
|||
current[:available_queries_for_explain] = original
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,7 +9,7 @@ module ActiveRecord
|
|||
MULTI_VALUE_METHODS = [:select, :group, :order, :joins, :where, :having, :bind]
|
||||
SINGLE_VALUE_METHODS = [:limit, :offset, :lock, :readonly, :from, :reorder, :reverse_order, :uniq]
|
||||
|
||||
include FinderMethods, Calculations, SpawnMethods, QueryMethods, Batches, Explain::ClassMethods, Delegation
|
||||
include FinderMethods, Calculations, SpawnMethods, QueryMethods, Batches, Explain, Delegation
|
||||
|
||||
attr_reader :table, :klass, :loaded
|
||||
attr_accessor :extensions, :default_scoped
|
||||
|
|
Loading…
Reference in a new issue