gocardless/statesman — pull request #54 by hschoenburg (2014-05-21 21:37:47+00:00)
Title: Revert transitions

Adds three functions. Only supports active_record adapter!

validate_revert
- looks at the machine's successors as well as its history to determine which states can be reverted_to. Can handle 'forked' transition paths. Cannot handle multiple passes up and down the transition tree (because that muddles the history).

revert_to
- this creates a transition like any other, except it runs validate_revert instead of validate_transition.

before_revert
- adds a hash to callbacks that is run when on the transition when metadata[:reversion] is set to true.