aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/preloader
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-09-18 06:17:09 +0900
committerRyuta Kamizono <kamipo@gmail.com>2017-09-18 06:17:09 +0900
commit7f8f66e93136ef7ff602b6cdb1f6a7acfaafa486 (patch)
tree1da58fa2f25a5374380dad3d116a820a9f0609ab /activerecord/lib/active_record/associations/preloader
parentdb844d9fb30cd34411fcdcc6780f82aaa5471e81 (diff)
downloadrails-7f8f66e93136ef7ff602b6cdb1f6a7acfaafa486.tar.gz
rails-7f8f66e93136ef7ff602b6cdb1f6a7acfaafa486.tar.bz2
rails-7f8f66e93136ef7ff602b6cdb1f6a7acfaafa486.zip
Remove useless condition in `reset_association`
`through_scope` is not empty scope if `options[:source_type]` is given.
Diffstat (limited to 'activerecord/lib/active_record/associations/preloader')
-rw-r--r--activerecord/lib/active_record/associations/preloader/through_association.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/preloader/through_association.rb b/activerecord/lib/active_record/associations/preloader/through_association.rb
index 8aac00d910..7b37ec2f41 100644
--- a/activerecord/lib/active_record/associations/preloader/through_association.rb
+++ b/activerecord/lib/active_record/associations/preloader/through_association.rb
@@ -68,8 +68,7 @@ module ActiveRecord
end
def reset_association(owners, association_name, through_scope)
- should_reset = (through_scope != through_reflection.klass.unscoped) ||
- (options[:source_type] && through_reflection.collection?)
+ should_reset = through_scope != through_reflection.klass.unscoped
# Don't cache the association - we would only be caching a subset
if should_reset