rails/rails — pull request #7822 by lulalala (2012-10-02 14:51:34+00:00)
Title: Fix reset_counters crashing on has_many :through associations.

Currently when a counter cache column name is specified in the intermediate model of a `has_many :through` association, the `reset_counters()` method is unable to get the model where the column resides in. The resulting error is:

> NoMethodError: undefined method `counter_cache_column' for nil:NilClass

The correct model reference has to be accessed using the additional `through_reflection` object.