1
0
Fork 0
mirror of https://github.com/aasm/aasm synced 2023-03-27 23:22:41 -04:00
aasm/spec/models/nobrainer/complex_no_brainer_example.rb
Guillaume Hain 65073e360a Add support for Nobrainer (RethinkDB)
* Add persistence for NoBrainer
* Add tests for NoBrainer
* Show the ORM version when running the tests
* Add a Dockerfile and a docker-compose.yml file allowing to run from anywhere very easily the test suite with `docker-compose run --rm aasm\'
* Moves the Mongoid database name definition in the gem loader (avoiding code repetition)
* Update the CHANGELOG.md and the README.md files
* Add Rails generator for NoBrainer
2018-02-13 12:49:27 +05:30

36 lines
759 B
Ruby

class ComplexNoBrainerExample
include NoBrainer::Document
include AASM
field :left, type: String
field :right, type: String
aasm :left, column: 'left' do
state :one, initial: true
state :two
state :three
event :increment do
transitions from: :one, to: :two
transitions from: :two, to: :three
end
event :reset do
transitions from: :three, to: :one
end
end
aasm :right, column: 'right' do
state :alpha, initial: true
state :beta
state :gamma
event :level_up do
transitions from: :alpha, to: :beta
transitions from: :beta, to: :gamma
end
event :level_down do
transitions from: :gamma, to: :beta
transitions from: :beta, to: :alpha
end
end
end