Need to clarify the use of ruby ​​government

My problem is that I have an application that gives the user the ability to define a workflow (states, transitions, events, etc.) and my application knows how it reacts (transitions) based on the users workflow.

I've looked at a few state gems like AASM and I see how I could use a gem to pre-define the state machine , but if the state machine needs to be changed, it looks like I would have to modify the code and redeploy. I argued with a colleague of mine about how we could / could not use a gem in a government computer to do what we want, but to me they all seem to define a static state machine, and changing that state requires a code change.

His proposal dynamically modifies the Ruby class to accommodate changes in the user's workflow. My thought is that states, transitions, events, guards, etc. They are persistent objects that the user modifies through our API. None of our current thoughts seem to work with the current Ruby state machines without significant modification on top of these gems.

The place I see as an example solution is JIRA and how you can dynamically define states, transitions, and other workflow attributes for a project.

+3


source to share


2 answers


Machine state should be used when business logic is predefined, otherwise you should model it differently. If you want users to create their own workflow (e.g. states, transitions, events), then it would be wise to create separate models for state, transition, and event and define their relationships in code.



Then you can have, say, several kinds of transitions and events that have different results. If you could describe in detail what kind of dynamic workflow you need, I could tell you more - working on a similar project right now, although we have not yet introduced events and transitions to the workflow.

0


source


The state_machine gem allows you to:



https://github.com/pluginaweek/state_machine#static--dynamic-definitions

0


source







All Articles