In a Rails 3.2 app I have a User model that has many Awards.

The Award class has :type, :level and :image attributes.

On a User's show page I want to show their Awards, but with some criteria. User.awards should be grouped by both type and level, and for each type-level combination I want to display its image, and a count of the awards.

I'm struggling to construct the queries and views to achieve this (and to explain this clearly). 

How can I group on two attributes of a child record, and then display both a count and attribute (i.e. image) of those children?