aasm/spec/models/basic_two_state_machines_ex...

26 lines
505 B
Ruby

class BasicTwoStateMachinesExample
include AASM
aasm :search do
state :initialised, :initial => true
state :queried
state :requested
event :query do
transitions :from => [:initialised, :requested], :to => :queried
end
event :request do
transitions :from => :queried, :to => :requested
end
end
aasm :sync do
state :unsynced, :initial => true
state :synced
event :sync do
transitions :from => :unsynced, :to => :synced
end
end
end