Gem AASM supports multiple state machine per class with verion 4.3 or above. A unique state machine selector is used for each state machine in one class. Can one state appear in multiple state machine?
Here is an example. The state walking
appears in both :move
and :work
. Is state walking
all right? Or I have to name differently like: state walking_move
and state waling_work
.
class SimpleMultipleExample
include AASM
aasm(:move) do
state :standing, :initial => true
state :walking #<====
event :walk do
transitions :from => :standing, :to => :walking
end
end
aasm(:work) do
state :sleeping, :initial => true
state :walking #<====
event :start do
transitions :from => :sleeping, :to => :walking
end
end
end
Also can all initial state be the same such as initial_state
in different state machine?