method

size

rails latest stable - Class: ActiveRecord::Associations::HasManyThroughAssociation

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v4.2.9) is shown here.

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.