gocardless/statesman — pull request #26 by banderous (2014-02-26 16:50:34+00:00)
Title: Refactor adapter callback interface

With this change, data adapters no longer receive sets of callbacks which they are responsible for executing at the appropriate time.

Now, adapters receive an observer object that they are required to notify when they reach the following stages of a transition:

:before
:after
:after_commit

The after_commit stage has been added to provide a hook at the point the state change becomes visible to the outside world.

Otherwise, any observers notified outside of a transactional system such as active record will read stale state if looking at the current state machine state.