empty?()
Instance Public methods
Returns true if the collection is empty. If the collection has
been loaded it is equivalent to collection.size.zero?. If the
collection has not been loaded, it is equivalent to
collection.exists?. If the collection has not already been
loaded and you are going to fetch the records anyway it is better to check
collection.length.zero?.
class Person < ActiveRecord::Base
has_many :pets
end
person.pets.count # => 1
person.pets.empty? # => fa