sob (owner)

Revisions

gist: 53376 Download_button fork
public
Public Clone URL: git://gist.github.com/53376.git
Embed All Files: show embed
lead.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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