Skip to content

Instantly share code, notes, and snippets.

@obrie
Forked from mghaught/state_machine_model.rb
Created May 5, 2011 16:55
Show Gist options
  • Save obrie/957413 to your computer and use it in GitHub Desktop.
Save obrie/957413 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