Class: LeadObserver

Inherits:
ActiveRecord::Observer
  • Object
show all
Defined in:
app/models/observers/lead_observer.rb

Overview

Fat Free CRM Copyright © 2008-2011 by Michael Dvorkin

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <www.gnu.org/licenses/>.


Constant Summary collapse

@@leads =
{}

Instance Method Summary collapse

Instance Method Details

#after_update(item) ⇒ Object



27
28
29
30
31
32
# File 'app/models/observers/lead_observer.rb', line 27

def after_update(item)
  original = @@leads.delete(item.id)
  if original && original.status != "rejected" && item.status == "rejected"
    return log_activity(item, :reject)
  end
end

#before_update(item) ⇒ Object



23
24
25
# File 'app/models/observers/lead_observer.rb', line 23

def before_update(item)
  @@leads[item.id] = Lead.find(item.id).freeze
end