mirror of
https://github.com/aasm/aasm
synced 2023-03-27 23:22:41 -04:00
24 lines
497 B
Ruby
24 lines
497 B
Ruby
class ProvidedState
|
|
attr_accessor :transient_store, :persisted_store
|
|
include AASM
|
|
aasm do
|
|
state :alpha, :initial => true
|
|
state :beta
|
|
state :gamma
|
|
event :release do
|
|
transitions :from => [:alpha, :beta, :gamma], :to => :beta
|
|
end
|
|
end
|
|
|
|
def aasm_read_state(*args)
|
|
:beta
|
|
end
|
|
|
|
def aasm_write_state(new_state, *args)
|
|
@persisted_store = new_state
|
|
end
|
|
|
|
def aasm_write_state_without_persistence(new_state, *args)
|
|
@transient_store = new_state
|
|
end
|
|
end
|