trying to do a scope in rails3.
:book has_many :chapters
I want scope :long to return books with > 10 chapters.
How best to structure
Ah - to answer my own question in the comment above, I had to put the count in the HAVING:
class Book scope :long, joins(:chapters). select('books.id'). group('books.id'). having('count(chapters.id) > 10') end