You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the states of your machine represent successive states instead of independent states (e.g. new -> pending -> ongoing -> completed), it is useful to know if a particular state has been passed. For example, if you want to know if a state has passed the pending state, you need to check if it is either ongoing or completed. This is not really maintainable if you have 10 or so states.
The following pattern would be really useful.
I was looking for a way to do something similar too. Storing the states as numeric values in the database could be a way to do this. This would also allow you to order queries by progressive state. I saw someone mentioned it's possible to store states as enums in PostgreSQL using the Statesman gem.
I'm about to investigate this myself. However, I'm not too keen on the Statesman gem as a whole and may come back to state_machine but I'm worried about a lack of a maintainer.
Hi all,
If the states of your machine represent successive states instead of independent states (e.g.
new
->pending
->ongoing
->completed
), it is useful to know if a particular state has been passed. For example, if you want to know if a state has passed the pending state, you need to check if it is eitherongoing
orcompleted
. This is not really maintainable if you have 10 or so states.The following pattern would be really useful.
Is there currently a generic way to achieve this?
The text was updated successfully, but these errors were encountered: