Rolling Counts

Hi

I just wondered if anyone has come up with an elegant solution to rolling counts for a RoR app?

Our requirement is to show most viewed items for the past week ... with this rolling each day.

Currently we are showing most viewed ever so that simply has one row in a table per item with an incremented count column.

It would be nice if somehow counter_cache extended to rolling data.

Any thoughts or suggestions?

Cheers Shane

I just wondered if anyone has come up with an elegant solution to rolling counts for a RoR app?

Our requirement is to show most viewed items for the past week ... with this rolling each day.

We have a polymorphic View model that let's us keep track of any model/object's views by day. We end up with a lot of rows, but our folks wanted it to go back a long way. Once you have this you can run some SQL to do the sums and group_by's to get what you want.