AASM
Statesman
Our great sponsors
AASM | Statesman | |
---|---|---|
3 | 3 | |
4,948 | 1,728 | |
0.6% | 1.6% | |
4.4 | 7.0 | |
about 2 months ago | 5 days ago | |
Ruby | Ruby | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
AASM
-
Code review of an Order object implemented as a state machine
AASM gem is great too! Easy to use and actively maintained.
-
RoR Gems: Pin To Plane For Developing RoR Application
6. AASM
-
Validate state transition easily without any gem
You can use state machine gems, such as aasm to write validation. But the gem introduces new DSL to write state transition. It's too much just for validation.
Statesman
-
Why Developers Never Use State Machines (2011)
I’d strongly recommend Statesman instead: https://gocardless.com/blog/statesman/
I’m unaffiliated, just have used a lot of Ruby SM libraries.
-
State Machines in Ruby: An Introduction
Honestly state machines are fantastic in Rails too. My last company built [Statesman](https://github.com/gocardless/statesman/) and being able to lean on it to prevent you getting into invalid states is fantastic. You also get the bonus of tracking the history of states your resources went through (which is especially useful when you're dealing with payments).
At some point you'll have to think about query performance on the state transition table, but it'll go further than you think and is firmly in the realm of problems of success.
-
Code review of an Order object implemented as a state machine
I know you were doing educational proof of concent. But when I write them, I usually reach for the statesman gem. Makes state machines pretty trivial IME.
What are some alternatives?
State Machine - Adds support for creating state machines for attributes on any Ruby class
Workflow - Ruby finite-state-machine-inspired API for modeling workflow
transitions - State machine extracted from ActiveModel
state_machines - Adds support for creating state machines for attributes on any Ruby class
StatefulEnum - A very simple state machine plugin built on top of ActiveRecord::Enum
FeatureFlags - Feature flags for Rails application.Manages ‘flags’ within your Rails app that determine whether various features are enabled or not.
FiniteMachine - A minimal finite state machine with a straightforward syntax.