Skip to content

Instantly share code, notes, and snippets.

@bokmann
Created April 15, 2010 14:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bokmann/367181 to your computer and use it in GitHub Desktop.
Save bokmann/367181 to your computer and use it in GitHub Desktop.
class YourTypicalWorkitem < ActiveRecord::Base
include StonePath
stonepath_workitem do
aasm_initial_state :data_entry
aasm_state :data_entry
aasm_state :data_validation
aasm_state :further_processing
aasm_event :validate_data do
transitions :to => :data_validation,
:from => :data_entry
end
aasm_event :kickback do
transitions :to => :data_entry,
:from => :data_validation,
:on_transition => :handle_kickback
end
aasm_event :approve do
transitions :to => :further_processing,
:from => :data_validation
end
end
def handle_kickback(reason)
# do something here with the reason you have been passed
puts "Reason Provided: #{reason}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment