v2.1.0 - Show latest stable - 0 notes - Class: ActiveRecord::Associations::AssociationCollection
size() public

Returns the size of the collection by executing a SELECT COUNT(*) query if the collection hasn’t been loaded and calling collection.size if it has. If it’s more likely than not that the collection does have a size larger than zero and you need to fetch that collection afterwards, it’ll take one less SELECT query if you use length.

Show source
Register or log in to add new notes.