-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do you model state_machine style transitions? #56
Comments
#63 doesn't solve the problem. It's not possible to make two transitions from one state in a single event,. The only way now is to implement "event" method manually with branching statement. @mrappleton what do you think about adding :if statement to transition method? |
I believe #78 would allow you to put a guard on the transition |
@isaacseymour Yes, that's exactly what I'd hope to happen. That's the only issue keeping me from using statesman on our project right now. |
@markquezada we've discussed adding this kind of behaviour to Statesman in the office and decided it goes against the underlying philosophy of the gem - see [this comment[(https://github.com//pull/78#issuecomment-56190184). We think this behaviour belongs in your controller, or something like a |
I've added some comments directly on that pull request. |
Most of the discussion on this is now in #78 (comment), so I'm going to close this. |
Hi, I just came across Statesman and it looks awesome.
This is more of a question than a bug, but I didn't know where else to ask. I'm trying out Statesman by converting an old project that used the
state_machine
gem. A common pattern used with that gem is to define several transitions on an event like so:The key point being that you can define a transition for what happens if
deliver_text_message
fails.I can't quite figure out how to model something like this with Statesman since all transitions are defined by their "from" and "to" states, not with an explicit "event" like in
state_machine
. The only thing I can think of is that you're deliberately pushing this type of functionality up the stack into a service object, or the like.I'm curious how you're modeling something like this where state transition is dependent on say, an API's return value?
The text was updated successfully, but these errors were encountered: