aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/base.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2018-06-25 14:22:32 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2018-06-25 14:22:32 -0700
commit657060b5f8c14fc6249fc19231f703a7c749d84e (patch)
tree5404526cd7e88996cf5f96123468e4c66415172a /activerecord/lib/active_record/base.rb
parent83247916c934a92f0f9d69ee13cd8532c3d16d0e (diff)
downloadrails-657060b5f8c14fc6249fc19231f703a7c749d84e.tar.gz
rails-657060b5f8c14fc6249fc19231f703a7c749d84e.tar.bz2
rails-657060b5f8c14fc6249fc19231f703a7c749d84e.zip
Lazily add `Aggregations` to `composed_of` models
`composed_of` is a fairly rare method to call on models. This commit adds the `Aggregations` module to models that call `composed_of` so that models that *don't* call `composed_of` don't need to instantiate the `aggregation_cache` hash. This saves one hash allocation per model instance that doesn't use `composed_of`
Diffstat (limited to 'activerecord/lib/active_record/base.rb')
-rw-r--r--activerecord/lib/active_record/base.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 7ab9160265..5169f312f5 100644
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -288,6 +288,7 @@ module ActiveRecord #:nodoc:
extend Enum
extend Delegation::DelegateCache
extend CollectionCacheKey
+ extend Aggregations::ClassMethods
include Core
include DatabaseConfigurations
@@ -314,7 +315,6 @@ module ActiveRecord #:nodoc:
include ActiveModel::SecurePassword
include AutosaveAssociation
include NestedAttributes
- include Aggregations
include Transactions
include TouchLater
include NoTouching