magnusvk/counter_culture — pull request #28 by luvtechno (2013-10-09 10:28:17+00:00)
Title: Fix counter_culture_fix_counts for a case no dependent record exists for some of main records

Fixing an issue that `counter_culture_fix_counts` updates counter cache values incorrectly when num of main model records is larger than `batch_size` and no dependent model record exist for some.

The problem was that `INNER JOIN` is used in the count query, results of which will have no row if no corresponding record exists on the joined model. As a result, `records` and `counts` queries iterate over different set of the main model records. Replacing `INNER JOIN` with `LEFT JOIN` will fix the issue.