mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
In Relation#empty? use #exists? instead of #count.
This commit is contained in:
parent
db82e1d0bb
commit
4ba9c508ec
2 changed files with 5 additions and 2 deletions
|
@ -1,3 +1,7 @@
|
|||
* Make `Relation#empty?` use `exists?` instead of `count`.
|
||||
|
||||
*Szymon Nowak*
|
||||
|
||||
* `rake db:structure:dump` no longer crashes when the port was specified as `Fixnum`.
|
||||
|
||||
*Kenta Okamoto*
|
||||
|
|
|
@ -244,8 +244,7 @@ module ActiveRecord
|
|||
def empty?
|
||||
return @records.empty? if loaded?
|
||||
|
||||
c = count(:all)
|
||||
c.respond_to?(:zero?) ? c.zero? : c.empty?
|
||||
limit_value == 0 ? true : !exists?
|
||||
end
|
||||
|
||||
# Returns true if there are any records.
|
||||
|
|
Loading…
Reference in a new issue