Creating a grid layout based on (pairs of) model attributes


I've tried looking for an answer to this via Google, various forums etc
but have not found one yet - which seems surprising as I don't think the
requirement is that unusual.

Is there an 'off the shelf' gem or rails plugin to create a grid or
matrix based upon attributes of a model?

I've written a mechanism to suit my immediate needs but I'm wondering if
there's a general purpose one available; or whether it's worth making my
implementation more generic and releasing it for others to use.

Basically, what I'm looking to do is take a list of objects which have
attributes 'name','A' and 'B' and produce a table with A across the top,
B down the side and 'name' in cells where the object matches both A and

eg my object contains "name", "category" and "context"
the range of values for each of "category" and "context" is fixed.

What I'd like is (and this looks OK in fixed width fonts)

Apologies - it looke OK until I hit submit !

the table looks messy in proportional fonts -- in a CSV equivalent

# Category, Office, Home, Car, Boat

CD Player, Acme1000, MegaCD-III, Dashplayer, Portaplayer

Television, ,BigPix HD, , miniscreen

GPS , , , Whereami-x10, Titanic-II
GPS , , , GetmeHome++, Vandervecken-XX|