innoQ

Vladimir's Tech Blog


acts_as_state_machine successor 'workflow'

February 24, 2009

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.

Trackback Pings

TrackBack URL for this entry:
http://www.innoq.com/movabletype/mt-tb.cgi/3076

Comments

Post a comment




Remember Me?


Powered by Movable Type 3.31