Skip to content

Instantly share code, notes, and snippets.

@mghaught
Created May 5, 2011 15:12
Show Gist options
  • Save mghaught/957234 to your computer and use it in GitHub Desktop.
Save mghaught/957234 to your computer and use it in GitHub Desktop.
state_machine setup
state_machine :checkout_state, :initial => :address, :use_transactions => false do
state :delivery
state :payment
state :confirm
state :complete
event :next do
transition :from => 'address', :to => 'delivery'
transition :from => 'delivery', :to => 'payment'
transition :from => 'payment', :to => 'confirm'
transition :from => 'confirm', :to => 'complete'
end
before_transition :to => 'complete', :do => :process_payments!
after_transition :to => 'complete', :do => :finalize!
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment