ActiveRecord Associations: Count vs. Size vs. Length
Short answer: use size. It will give you a count of the objects without actually loading them, and it’s smart enough to avoid hitting the database if the association has already been loaded. Furthermore, it picks up on counter caches when you follow naming conventions. More info at Robot Has No Heart.