From 9a7409bb2807542226f4ba907c8386647e3c2fd1 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Tue, 6 Sep 2016 10:03:24 +0900 Subject: Remove redundant `!loaded?` condition Already checked `if !find_target? || loaded?`, unnecessary `!loaded?` in elsif condition. --- activerecord/lib/active_record/associations/collection_association.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/associations/collection_association.rb b/activerecord/lib/active_record/associations/collection_association.rb index d344277ab2..08bd532fb0 100644 --- a/activerecord/lib/active_record/associations/collection_association.rb +++ b/activerecord/lib/active_record/associations/collection_association.rb @@ -227,9 +227,9 @@ module ActiveRecord else target.size end - elsif !loaded? && !association_scope.group_values.empty? + elsif !association_scope.group_values.empty? load_target.size - elsif !loaded? && !association_scope.distinct_value && target.is_a?(Array) + elsif !association_scope.distinct_value && target.is_a?(Array) unsaved_records = target.select(&:new_record?) unsaved_records.size + count_records else -- cgit v1.2.3