instance method
empty?
Ruby on Rails 4.1.16
Since v3.0.20Signature
empty?()
Returns true if there are no records.
Source
# File activerecord/lib/active_record/relation.rb, line 251
def empty?
return @records.empty? if loaded?
if limit_value == 0
true
else
c = count(:all)
c.respond_to?(:zero?) ? c.zero? : c.empty?
end
end
Defined in activerecord/lib/active_record/relation.rb line 251
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Relation