app/models/event_rule.rb in ffcrm_cloudfuji-0.3.1 vs app/models/event_rule.rb in ffcrm_cloudfuji-0.4.1

- old
+ new

@@ -22,11 +22,11 @@ count = LeadEventRuleCount.find_by_lead_id_and_event_rule_id(lead, self) || LeadEventRuleCount.new(:lead => lead, :event_rule => self) # Don't apply this rule more than limit_per_lead, if set unless limit_per_lead.present? && count.count > limit_per_lead # If :match is present, only apply the rule if data matches string - if match.blank? || (params['data'] && event_matches?(params)) + if match.blank? || event_matches?(params) if (app_id.blank? && page_name.blank?) || page_and_app_matches?(params) # Run the action method if defined if respond_to?(action) send(action, lead, params) # Increment and save count of rule/lead applications @@ -55,11 +55,11 @@ # Fire a Cloudfuji event message = case event_category when 'cloudfuji_event_received' "Cloudfuji event was received - '#{cloudfuji_event}'" when 'lead_attribute_changed' - "Lead \"#{lead.full_name}\" was updated - #{lead_attribute} was changed from '#{match_data[0]}' to '#{match_data[1]}'." + "Lead \"#{lead.full_name}\" was updated - #{lead_attribute} was changed from '#{match_data['old_value']}' to '#{match_data['new_value']}'." end User.all.each do |user| user.notify(lead.full_name, message, "crm") if !user.ido_id.nil? end @@ -107,10 +107,10 @@ when 'cloudfuji_event_received' match_string = params['data'].inspect match_string.downcase! if case_insensitive_matching match_string.include?(test_string) when 'lead_attribute_changed' - match_string = params[1].to_s.dup + match_string = params['new_value'].to_s.dup match_string.downcase! if case_insensitive_matching match_string == test_string.to_s end end