lardawge/carrierwave_backgrounder — pull request #83 by sauliusg (2012-11-11 10:20:36+00:00)
Title: Use after_commit if it is available to support reactive workers.

Hi,

this fixes after_commit support. The callback is specific to ActiveRecord therefore I added a check to see if it is available. Current implementation essentially breaks Mongoid compatibility.

Moreover, #_changed? will always respond with false in after_commit block, because changes hash is already reset. So no background processing will be even triggered. To properly support after_commit we need to check previous_changes hash instead. There is a pretty good explanation here: http://logicalfriday.com/2012/08/21/rails-callbacks-workers-and-the-race-you-never-expected-to-lose/.

Cheers