mirror of
https://github.com/aasm/aasm
synced 2023-03-27 23:22:41 -04:00
26 lines
555 B
Ruby
26 lines
555 B
Ruby
|
db = Sequel.connect(SEQUEL_DB)
|
||
|
|
||
|
# if you want to see the statements while running the spec enable the following line
|
||
|
# db.loggers << Logger.new($stderr)
|
||
|
db.create_table(:multiples) do
|
||
|
primary_key :id
|
||
|
String :status
|
||
|
end
|
||
|
|
||
|
class SequelMultiple < Sequel::Model(db)
|
||
|
set_dataset(:multiples)
|
||
|
include AASM
|
||
|
|
||
|
attr_accessor :default
|
||
|
|
||
|
aasm :left, :column => :status
|
||
|
aasm :left do
|
||
|
state :alpha, :initial => true
|
||
|
state :beta
|
||
|
state :gamma
|
||
|
event :release do
|
||
|
transitions :from => [:alpha, :beta, :gamma], :to => :beta
|
||
|
end
|
||
|
end
|
||
|
end
|