class Article
has_many :comments
end
class Comment
belongs_to :article
end
I’d like to be able to determine how many total comments exist for certain articles. For example: Article #20, #21 and #22 have a total of X comments between them.
Any pointers would be great!
I suggest this:
Doing the counting etc. in the database and all in one query (which ActiveRecord will, in this case) is about as efficient as possible.