The following will get one post per category:
Post.group(:category_id).order('count *')
I could then show a table of representative posts, one per category by listing each result:
CATEGORY | SAMPLE POST ID | SAMPLE POST TITLE
        1        |             123           | How to swim out loud
        2        |             246           | On Hamlet
However, I'd like to include the count of posts in this category, e.g.:
CATEGORY | AMOUNT | SAMPLE POST ID | SAMPLE POST TITLE
        1        |       5       |            123           | How to swim out loud
        2        |       2       |            246           | On Hamlet
How can we also show the amount, ie the "count per group"? There's hopefully a way to extract it from the "Post" results as part of an appropriate ActiveRecord query.
Note there's no "Category" table here. category_id is just an independent column. Therefore counter_cache is not a possibility.
 
     
     
    