diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2018-01-03 05:44:11 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2018-01-03 05:44:11 +0900 |
commit | 401c42e3c3ed78e6222dd6abb982216ccd8d519e (patch) | |
tree | a611f42dd75bb28880b6a1a442b43020b806aa75 /activerecord/lib/active_record | |
parent | a954e1e81711def521644050db9a08f073d0636c (diff) | |
parent | 4a7b4f88cd3fc10ab56edc3f88d5db0c4f871dc9 (diff) | |
download | rails-401c42e3c3ed78e6222dd6abb982216ccd8d519e.tar.gz rails-401c42e3c3ed78e6222dd6abb982216ccd8d519e.tar.bz2 rails-401c42e3c3ed78e6222dd6abb982216ccd8d519e.zip |
Merge pull request #27561 from fishbrain/count-all-in-has-many-association
Use `count(:all)` in HasManyAssociation#count_records
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/associations/has_many_association.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/has_many_association.rb b/activerecord/lib/active_record/associations/has_many_association.rb index 07c7f28d2d..cf85a87fa7 100644 --- a/activerecord/lib/active_record/associations/has_many_association.rb +++ b/activerecord/lib/active_record/associations/has_many_association.rb @@ -63,7 +63,7 @@ module ActiveRecord count = if reflection.has_cached_counter? owner._read_attribute(reflection.counter_cache_column).to_i else - scope.count + scope.count(:all) end # If there's nothing in the database and @target has no new records |