jah2488/mongoid-magic-counter-cache — pull request #15 by joe1chen (2014-03-16 04:00:00+00:00)
Title: Add if_update option for conditionally updating counter in after_update hook.

This pull builds on top of the conditional update functionality. It allows updates to the counter to be made when an update has been made to an embedded/referenced object.

Without this pull, the conditional code is sort of incomplete since you will have to manually increment/decrement the counter when you update the field in the embedded/referenced object that the :if condition depends on.

See the new specs I've added - "should increase counter when old unpublished review is published" and "should decrease counter when old published review is unpublished".