class ActiveRecord::Associations::CollectionAssociation
def empty?
loaded and you are going to fetch the records anyway it is better to
!collection.exists?. If the collection has not already been
collection has not been loaded, it is equivalent to
it is equivalent to collection.size.zero?. If the
If the collection has been loaded
Returns true if the collection is empty.
def empty? if loaded? || @association_ids || reflection.has_cached_counter? size.zero? else target.empty? && !scope.exists? end end