Skip to content

Instantly share code, notes, and snippets.

@ariejan
Created May 13, 2013 08:37
Show Gist options
  • Save ariejan/5566955 to your computer and use it in GitHub Desktop.
Save ariejan/5566955 to your computer and use it in GitHub Desktop.
States.
state_machine :state, initial: :concept do
state :concept
state :incomplete
state :complete
state :dismissed
event :cancel do
transition [:concept, :incomplete, :complete] => :dismissed
end
end
state_machine :export_state, initial: :unexportable do
state :unexportable
state :blocked
state :exportable
state :exported
after_transition on: :unblock, do: :check_exportability
event :block do
transition [:unexportable, :exportable] => :blocked
end
event :unblock do
transition [:blocked] => :unexportable
end
end
state_machine :payment_state, initial: :unpaid do
state :unpaid
state :paid
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment