Ruby on Rails latest stable (v4.0.2) - 0 notes - Class: CollectionAssociation
empty?() public

Returns true if the collection is empty.

If the collection has been loaded or the :counter_sql option is provided, 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?.

Show source
Register or log in to add new notes.