rails/rails — pull request #8447 by matthewrobertson (2012-12-07 11:21:57+00:00)
Title: Don't detect counter_caches by attribute name

This commit fixes issue #8446 in which false positive detection of `counter_cache` columns causes inconsistent behaviour in `has_many` associations.

The approach used here is to query the `belongs_to` side of an association to discover if the `counter_cache` option is set.