diff --git a/activerecord/lib/active_record.rb b/activerecord/lib/active_record.rb
index d5b6d40514e3a..58673ab7bd385 100644
--- a/activerecord/lib/active_record.rb
+++ b/activerecord/lib/active_record.rb
@@ -53,14 +53,13 @@ module ActiveRecord
autoload_under 'relation' do
autoload :QueryMethods
autoload :FinderMethods
- autoload :CalculationMethods
+ autoload :Calculations
autoload :PredicateBuilder
autoload :SpawnMethods
end
autoload :Base
autoload :Batches
- autoload :Calculations
autoload :Callbacks
autoload :DynamicFinderMatch
autoload :DynamicScopeMatch
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 06244d1132ad9..e10df1abd3b1c 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -654,6 +654,7 @@ def find(*args)
end
delegate :select, :group, :order, :limit, :joins, :where, :preload, :eager_load, :includes, :from, :lock, :readonly, :having, :to => :scoped
+ delegate :count, :average, :minimum, :maximum, :sum, :calculate, :to => :scoped
# A convenience wrapper for find(:first, *args). You can pass in all the
# same arguments to this method as you can to find(:first).
@@ -2742,7 +2743,7 @@ def quoted_comma_pair_list(quoter, hash)
# #save_with_autosave_associations to be wrapped inside a transaction.
include AutosaveAssociation, NestedAttributes
- include Aggregations, Transactions, Reflection, Batches, Calculations, Serialization
+ include Aggregations, Transactions, Reflection, Batches, Serialization
end
end
diff --git a/activerecord/lib/active_record/calculations.rb b/activerecord/lib/active_record/calculations.rb
deleted file mode 100644
index ea63617c52f5f..0000000000000
--- a/activerecord/lib/active_record/calculations.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-module ActiveRecord
- module Calculations #:nodoc:
- extend ActiveSupport::Concern
-
- module ClassMethods
- delegate :count, :average, :minimum, :maximum, :sum, :calculate, :to => :scoped
- end
- end
-end
diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb
index 19f91f4278c0f..6ac7137976df2 100644
--- a/activerecord/lib/active_record/relation.rb
+++ b/activerecord/lib/active_record/relation.rb
@@ -5,7 +5,7 @@ class Relation
MULTI_VALUE_METHODS = [:select, :group, :order, :joins, :where, :having]
SINGLE_VALUE_METHODS = [:limit, :offset, :lock, :readonly, :create_with, :from]
- include FinderMethods, CalculationMethods, SpawnMethods, QueryMethods
+ include FinderMethods, Calculations, SpawnMethods, QueryMethods
delegate :length, :collect, :map, :each, :all?, :include?, :to => :to_a
diff --git a/activerecord/lib/active_record/relation/calculation_methods.rb b/activerecord/lib/active_record/relation/calculations.rb
similarity index 99%
rename from activerecord/lib/active_record/relation/calculation_methods.rb
rename to activerecord/lib/active_record/relation/calculations.rb
index 155e90333c9dc..5645e7f031320 100644
--- a/activerecord/lib/active_record/relation/calculation_methods.rb
+++ b/activerecord/lib/active_record/relation/calculations.rb
@@ -1,5 +1,5 @@
module ActiveRecord
- module CalculationMethods
+ module Calculations
# Count operates using three different approaches.
#
# * Count all: By not passing any parameters to count, it will return a count of all the rows for the model.