otwcode/otwarchive — pull request #873 by CristinaRO (2012-09-29 23:25:12+00:00)
Title: Hopeful fix for Issue 2221: negative or otherwise inaccurate tagging counts

At best, this will make it possible to reset tagging_count per tag, by editing the tag and saving it. No actual changes needed.

At worst, it just won't change it, but it doesn't break anything.

http://code.google.com/p/otwarchive/issues/detail?id=2221

(Doubts come from the nature of the problem: the ```taggings_count``` should never be awry, it should be maintained by Rails magic. Since we don't know what makes it wonky, we don't want to use the Rails native method to reset it - which would be ```Tag.reset_counters(tag_id, :taggings)``` - but do a manual update to whatever ```tag.taggings.count``` really is.

However, when trying to simulate the error conditions through the console, I found that I couldn't manually set the :taggings_count. I could fake an error situation by manually incrementing or decrementing though: ```Tag.decrement_counter(:taggings_count, tag_id)```, and then saving the tag through the wrangling interface fixed the count as desired.

Will definitely be a NeedsAttentionOnBeta.)