aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/preloader
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-09-05 01:17:33 +0900
committerRyuta Kamizono <kamipo@gmail.com>2017-09-05 01:17:33 +0900
commit2b5f5cdd7c1d95716de6a206b6d09ccbb006dc17 (patch)
tree6a1952001a99ee58a7eb33157ddd08085d8ab59d /activerecord/lib/active_record/associations/preloader
parent9551bad98fc7604d460427946183bdfca7a2f8d4 (diff)
downloadrails-2b5f5cdd7c1d95716de6a206b6d09ccbb006dc17.tar.gz
rails-2b5f5cdd7c1d95716de6a206b6d09ccbb006dc17.tar.bz2
rails-2b5f5cdd7c1d95716de6a206b6d09ccbb006dc17.zip
Don't merge `reflection_scope` if `reflection.scope` isn't given
If `reflection.scope` isn't given, `reflection_scope` is always `klass.unscoped`. it is unnecessary to merge it.
Diffstat (limited to 'activerecord/lib/active_record/associations/preloader')
-rw-r--r--activerecord/lib/active_record/associations/preloader/association.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/preloader/association.rb b/activerecord/lib/active_record/associations/preloader/association.rb
index 3fa97af759..7bfb85fb32 100644
--- a/activerecord/lib/active_record/associations/preloader/association.rb
+++ b/activerecord/lib/active_record/associations/preloader/association.rb
@@ -123,7 +123,7 @@ module ActiveRecord
scope.where!(reflection.type => model.base_class.sti_name)
end
- scope.merge!(reflection_scope)
+ scope.merge!(reflection_scope) if reflection.scope
scope.merge!(preload_scope) if preload_scope
scope
end