Skip to content

Instantly share code, notes, and snippets.

@joshuaclayton
Created March 9, 2009 02:45
Show Gist options
  • Select an option

  • Save joshuaclayton/76067 to your computer and use it in GitHub Desktop.

Select an option

Save joshuaclayton/76067 to your computer and use it in GitHub Desktop.
base.send :include, AASM
base.aasm_column :status
base.aasm_initial_state :drafted
base.aasm_state :drafted
base.aasm_state :submitted
base.aasm_state :booked
base.aasm_state :lost
base.aasm_state :cancelled
base.aasm_event :submit do
transitions :to => :submitted, :from => [:drafted, :lost], :on_transition => lambda {|quote| quote.cache_project_total }
end
base.acts_as_state_machine :initial => :not_started
base.state :not_started
base.state :working
base.state :pending_approval
base.state :approved, :enter => lambda { |order| OrderMailer::deliver_order_approved_notice(order) }
base.state :submitted
base.state :disapproved
base.event :submit_order_for_approval do
transitions :from => :working, :to => :approved
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment