magnusvk/counter_culture — pull request #20 by demillir (2013-07-30 03:51:03+00:00)
Title: Cache totals as well as counters

This pull request adds the `:delta_column` option, for tracking the total of an integer field in the counted records, not just the count of the counted records.

For example, suppose the counted (children) records have a field called `seconds_viewed`, and you want the target (parent) record to keep a running total of the reviews in its `total_viewing_time` field. The child model could look like:

```
def Child
belongs_to :parent
counter_culture :parent, :column_name => 'total_viewing_time', :delta_column => 'seconds_viewed'
end
```