Skip to content

Instantly share code, notes, and snippets.

@kalashnikovisme
Created February 4, 2021 00:57
Show Gist options
  • Save kalashnikovisme/326b11a5c3659989ac067a488ffe93d1 to your computer and use it in GitHub Desktop.
Save kalashnikovisme/326b11a5c3659989ac067a488ffe93d1 to your computer and use it in GitHub Desktop.
Medium. Get list of state machines names provided by gem `aasm` article
class SimpleMultipleExample
include AASM
aasm(:move, column: 'move_state') do
state :standing, initial: true
state :walking
state :running
event :walk do
transitions from: :standing, to: :walking
end
event :run do
transitions from: [:standing, :walking], to: :running
end
event :hold do
transitions from: [:walking, :running], to: :standing
end
end
aasm(:work, column: 'work_state') do
state :sleeping, initial: true
state :processing
event :start do
transitions from: :sleeping, to: :processing
end
event :stop do
transitions from: :processing, to: :sleeping
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment