diff options
author | Simon Woker <github@simonwoker.de> | 2014-04-10 16:58:39 +0000 |
---|---|---|
committer | Simon Woker <github@simonwoker.de> | 2014-04-10 16:58:39 +0000 |
commit | afd4d8205e6a3264c30a29e4a2de0f1e71ef0717 (patch) | |
tree | 930251fb12963067450fa672ed3990e253035694 /activerecord/lib/active_record | |
parent | d8d0fcb06aae164b57695749ee394eee6996ee4d (diff) | |
download | rails-afd4d8205e6a3264c30a29e4a2de0f1e71ef0717.tar.gz rails-afd4d8205e6a3264c30a29e4a2de0f1e71ef0717.tar.bz2 rails-afd4d8205e6a3264c30a29e4a2de0f1e71ef0717.zip |
Fix error for aggregate methods with select, see issue #13648
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/relation.rb | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 4d37ac6e2b..7cdae176a1 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -238,7 +238,7 @@ module ActiveRecord # Returns size of the records. def size - loaded? ? @records.length : count + loaded? ? @records.length : count(:all) end # Returns true if there are no records. @@ -248,8 +248,7 @@ module ActiveRecord if limit_value == 0 true else - # FIXME: This count is not compatible with #select('authors.*') or other select narrows - c = count + c = count(:all) c.respond_to?(:zero?) ? c.zero? : c.empty? end end |