1
0
Fork 0
mirror of https://github.com/aasm/aasm synced 2023-03-27 23:22:41 -04:00
aasm/spec/models/mongoid/silent_persistor_mongoid.rb
2017-02-24 13:01:23 +05:30

39 lines
853 B
Ruby

class SilentPersistorMongoid
include Mongoid::Document
include AASM
field :name
field :status
aasm :left, column: :status, whiny_persistence: false do
state :sleeping, :initial => true
state :running
event :run do
transitions :to => :running, :from => :sleeping
end
event :sleep do
transitions :to => :sleeping, :from => :running
end
end
validates_presence_of :name
end
class MultipleSilentPersistorMongoid
include Mongoid::Document
include AASM
field :name
field :status
aasm :left, column: :status, whiny_persistence: false do
state :sleeping, :initial => true
state :running
event :run do
transitions :to => :running, :from => :sleeping
end
event :sleep do
transitions :to => :sleeping, :from => :running
end
end
validates_presence_of :name
end