« January 2009 | Main | April 2009 »

February 24, 2009

acts_as_state_machine successor 'workflow'

While acts_as_state_machine was not maintained for some years, a couple of successor libraries sprang up. My favourite was workflow by Ryan Allen.

Unfortunately, after we had adopted it in our current project, we've found some undeterministic behaviour in the ActiveRecord integration area. So I've streamlined the integration code by:

  1. strictly separating the implementation between the state machine/workflow specification (states, transitions) and the model entity state
  2. putting all the model enhancements into modules and initiating the admixing the state machine functionality in the self.included method. The modules are::
    • WorkflowClassMethods
    • WorkflowInstanceMethods
    • ActiveRecordInstanceMethods

But you do not need to know all that implementation details to be able to use the workflow library. Just grab my version from github.

Posted by VladimirDobriakov at 6:36 PM | Comments (0) | TrackBack