geekq / workflow

Ruby finite-state-machine-inspired API for modeling workflow
MIT License
1.75k stars 207 forks source link

Can be in X state? othersie re-route #159

Closed gastonmorixe closed 2 years ago

gastonmorixe commented 9 years ago

Say I have 10 states, and many more events. There's one state called "active" but it can only be active if it passes certain checks I coded them under method "can_be_active?".

I don't want to put this check in all events, but right before active entrance. And if it it does not passes the checks, allow me to specify to go to another event (redirect it, say to "not_active") or to let it be in the prev state.

Is this current possible? How could it be archived?

Thank you all