Merge pull request #26451 from kamipo/remove_target_uniq_size

Remove unnecessary `target.uniq.size` in `CollectionAssociation#size`
This commit is contained in:
Sean Griffin 2016-11-01 14:20:17 -04:00 committed by GitHub
commit 4e8f1ba242

@ -219,11 +219,7 @@ def destroy(*records)
# +count_records+, which is a method descendants have to provide.
def size
if !find_target? || loaded?
if association_scope.distinct_value
target.uniq.size
else
target.size
end
target.size
elsif !association_scope.group_values.empty?
load_target.size
elsif !association_scope.distinct_value && target.is_a?(Array)