diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2016-09-06 10:03:24 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2016-09-06 10:06:30 +0900 |
commit | 9a7409bb2807542226f4ba907c8386647e3c2fd1 (patch) | |
tree | fa0fd9355966888c9477f1fd30e6db5cd45e7bae | |
parent | da33612d0ffd7750b4caebbaeeb9bc2635c14a12 (diff) | |
download | rails-9a7409bb2807542226f4ba907c8386647e3c2fd1.tar.gz rails-9a7409bb2807542226f4ba907c8386647e3c2fd1.tar.bz2 rails-9a7409bb2807542226f4ba907c8386647e3c2fd1.zip |
Remove redundant `!loaded?` condition
Already checked `if !find_target? || loaded?`, unnecessary `!loaded?` in
elsif condition.
-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 |