From 7f8f66e93136ef7ff602b6cdb1f6a7acfaafa486 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Mon, 18 Sep 2017 06:17:09 +0900 Subject: Remove useless condition in `reset_association` `through_scope` is not empty scope if `options[:source_type]` is given. --- .../lib/active_record/associations/preloader/through_association.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'activerecord') 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 -- cgit v1.2.3