Skip to content

Instantly share code, notes, and snippets.

@sob
Created January 27, 2009 15:07
Show Gist options
  • Save sob/53376 to your computer and use it in GitHub Desktop.
Save sob/53376 to your computer and use it in GitHub Desktop.
class Lead < ActiveRecord::Base
include Splam
has_force :oid => '<insert oid>'
validates_presence_of :first_name, :last_name
state_machine :state, :initial => 'pending' do
event :submit do
transition :to => 'spam', :from => 'pending', :if => :splam?
transition :to => 'submitted', :from => 'pending', :if => :to_salesforce
transition :to => 'pending'
end
after_transition :to => 'submitted', :do => :update_submitted_at # simple timestamp field
end
after_create :submit!
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment