How to join a table and count records in Rails 3? How to join a table and count records in Rails 3? ruby ruby

How to join a table and count records in Rails 3?


To answer my own question:

Collection.joins(:coins).group("coins.collection_id").having("count(coins.id) > 2")

Hat tip to KJF who asked this similar question and to krakover for answering it.