method

size

Importance_1
Ruby on Rails latest stable (v7.1.3.2) - 0 notes - Class: ActiveRecord::Associations::HasManyThroughAssociation
size() public

Returns the size of the collection by executing a SELECT COUNT(*) query if the collection hasn’t been loaded, and by calling collection.size if it has. If the collection will likely have a size greater than zero, and if fetching the collection will be needed afterwards, one less SELECT query will be generated by using #length instead.

Show source
Register or log in to add new notes.