The README shows that I need to include the following in a model:
include Statesman::Adapters::ActiveRecordQueries[
transition_class: OrderTransition,
initial_state: :pending
]
And build the machine itself like:
class OrderStateMachine
include Statesman::Machine
state :pending, initial: true
state :checking_out
end
At some point, I was thinking that initial_state option allow to set different initial state for a model that is using the same state machine. But it doesn't. This option also doesn't (right?) work if initial: true is not set. So, why this option is even added? This looks like a constant that can be taken from machine like initial_state: OrderStateMachine.initial_state during initialisation and cannot be changed by a user anyway.
Am I missing something?
The README shows that I need to include the following in a model:
And build the machine itself like:
At some point, I was thinking that
initial_stateoption allow to set different initial state for a model that is using the same state machine. But it doesn't. This option also doesn't (right?) work ifinitial: trueis not set. So, why this option is even added? This looks like a constant that can be taken from machine likeinitial_state: OrderStateMachine.initial_stateduring initialisation and cannot be changed by a user anyway.Am I missing something?