Sha256: 291505a199dabf8ec1a15a1405ca534eee3a4491c0f339041a3c399fcefda12e

Contents?: true

Size: 1.19 KB

Versions: 12

Compression:

Stored size: 1.19 KB

Contents

# Fat Free CRM
# Copyright (C) 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 <http://www.gnu.org/licenses/>.
#------------------------------------------------------------------------------

class CloudfujiLeadObserver < ActiveRecord::Observer
  observe :lead

  def after_update(lead)
    # Find all event rules where the lead attribute is one of the changed fields
    EventRule.find_all_by_event_category_and_lead_attribute('lead_attribute_changed', lead.changes.keys).each do |rule|
      rule.process(lead, lead.changes[rule.lead_attribute])  # Send [old, new] values as matching data
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
ffcrm_cloudfuji-0.3.1 app/observers/cloudfuji_lead_observer.rb
ffcrm_cloudfuji-0.3.0 app/observers/cloudfuji_lead_observer.rb
ffcrm_cloudfuji-0.2.11 app/observers/cloudfuji_lead_observer.rb
ffcrm_cloudfuji-0.2.10 app/observers/cloudfuji_lead_observer.rb
ffcrm_cloudfuji-0.2.9 app/observers/cloudfuji_lead_observer.rb
ffcrm_cloudfuji-0.2.8 app/observers/cloudfuji_lead_observer.rb
ffcrm_cloudfuji-0.2.7 app/observers/cloudfuji_lead_observer.rb
ffcrm_cloudfuji-0.2.6 app/observers/cloudfuji_lead_observer.rb
ffcrm_cloudfuji-0.2.5 app/observers/cloudfuji_lead_observer.rb
ffcrm_cloudfuji-0.2.4 app/observers/cloudfuji_lead_observer.rb
ffcrm_cloudfuji-0.2.3 app/observers/cloudfuji_lead_observer.rb
ffcrm_cloudfuji-0.2.2 app/observers/cloudfuji_lead_observer.rb