Ruby On Rails : Maintain User customizable dynamic workflow / State Machine

I am currently working on a software system that implements dynamic workflows. Dynamic in a sense that every workflow is created by the customer admin or super admin for particular organization. In other words its a multi-tenant application. So, formerly the dynamic workflow was being maintained via different tables and maintaining transition relationship between the state’s events. However, The way we were implementing the dynamic state transition was quite tricky and alot of mess. Then I heard there is a few gems to implement finite state machine ( Workflow ). After analyzing their features and our requirements found out that they do not support dynamics out of the box however could be hacked to support the dynamics.

Implementing Dynamic workflow using workflow gem

Among various gems I picked up the gem workflow. It was okay with static workflows but it was tricky to make it dynamic. So, after leveraging hooks available in ActiveRecord and little bit of meta-programming in Ruby I succeeded to add dynamics to the workflow. Now user /  CSA created workflows could transit from on state to another using various states.

Cont..

One thought on “Ruby On Rails : Maintain User customizable dynamic workflow / State Machine

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s