diff options
author | Andrew White <pixeltrix@users.noreply.github.com> | 2016-09-06 10:52:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-06 10:52:01 +0100 |
commit | 38fae35d53a029ee5b9c1192cb67ce2aa28f3904 (patch) | |
tree | a7a13a17095799f937114ed36658a5fcf5a0c5f2 /activerecord | |
parent | 495ef4124e292dcc7062e3e1f04f623053113101 (diff) | |
parent | 9a7409bb2807542226f4ba907c8386647e3c2fd1 (diff) | |
download | rails-38fae35d53a029ee5b9c1192cb67ce2aa28f3904.tar.gz rails-38fae35d53a029ee5b9c1192cb67ce2aa28f3904.tar.bz2 rails-38fae35d53a029ee5b9c1192cb67ce2aa28f3904.zip |
Merge pull request #26394 from kamipo/remove_redundant_condition
Remove redundant `!loaded?` condition
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/associations/collection_association.rb | 4 |
1 files changed, 2 insertions, 2 deletions
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 |