Is it possible to have more than one state_machine in a model.
How to setup (state column name, fire évents from this second state_machine ?)
Many thanks !
Well, in theory it should be possible, however I found out that this doesn't work right now unfortunately.
If I find the time, I'll fix that - of course pull requests are welcome..:-)
To be honest this isn't very high on my priority list, because whenever I had the need for two state machines, I basically wanted two different models. However I don't deny that there might be use cases where multiple state machines make sense, I just haven't encountered one.
As far as I can see even naming a state machine with
state_machine :foo do
breaks the functionality. But then again, naming a state machine only makes sense if we have more than one (otherwise it's just default), so this is all more or less the same issue.
I am thinking of something like this (This won't work right now):
state_machine do # name will be `default`
where you can switch like that
If you need that badly, you'll have to come up with a pull request I'm afraid..:-)
@dlepage Oh, and what's your use case for having multiple state machines for one model?
I see your reasoning. However, I am not convinced - "Human being" would be a "human" object composed of "body" and "spirit" for me...:-)
I am closing this issue.