mirror of
https://github.com/aasm/aasm
synced 2023-03-27 23:22:41 -04:00
39 lines
640 B
Ruby
39 lines
640 B
Ruby
class WithEnum < ActiveRecord::Base
|
|
include AASM
|
|
|
|
# Fake this column for testing purposes
|
|
attr_accessor :aasm_state
|
|
|
|
def self.test
|
|
{}
|
|
end
|
|
|
|
aasm :enum => :test do
|
|
state :opened
|
|
state :closed
|
|
|
|
event :view do
|
|
transitions :to => :read, :from => [:needs_attention]
|
|
end
|
|
end
|
|
end
|
|
|
|
class MultipleWithEnum < ActiveRecord::Base
|
|
include AASM
|
|
|
|
# Fake this column for testing purposes
|
|
attr_accessor :aasm_state
|
|
|
|
def self.test
|
|
{}
|
|
end
|
|
|
|
aasm :left, :enum => :test do
|
|
state :opened
|
|
state :closed
|
|
|
|
event :view do
|
|
transitions :to => :read, :from => [:needs_attention]
|
|
end
|
|
end
|
|
end
|