aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-05-30 04:37:25 +0900
committerRyuta Kamizono <kamipo@gmail.com>2017-05-30 04:37:25 +0900
commit5632f73042bc543d59e6f3e913e0d2cd44b54a65 (patch)
tree9391878e14aa665d36a76b448f8525e78f6abc22 /activerecord/lib/active_record/associations
parentd1249c1a91df614ceb10167155b0265b9578835e (diff)
downloadrails-5632f73042bc543d59e6f3e913e0d2cd44b54a65.tar.gz
rails-5632f73042bc543d59e6f3e913e0d2cd44b54a65.tar.bz2
rails-5632f73042bc543d59e6f3e913e0d2cd44b54a65.zip
Extract `default_extensions` to avoid `klass.all`
As @matthewd's suggestion, if `klass` has no default scope, it will more faster.
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r--activerecord/lib/active_record/associations/association.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/association.rb b/activerecord/lib/active_record/associations/association.rb
index e42162c740..0f330af2f6 100644
--- a/activerecord/lib/active_record/associations/association.rb
+++ b/activerecord/lib/active_record/associations/association.rb
@@ -134,7 +134,7 @@ module ActiveRecord
end
def extensions
- extensions = klass.all.extensions | reflection.extensions
+ extensions = klass.default_extensions | reflection.extensions
if scope = reflection.scope
extensions |= klass.unscoped.instance_exec(owner, &scope).extensions