Class: CommunicationEventObserver

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

Instance Method Summary collapse

Instance Method Details

#after_commit_on_create(comm_event) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'app/observers/communication_event_observer.rb', line 3

def after_commit_on_create(comm_event)
  Rails.logger.debug "CommunicationEventObserver - calling after_commit_on_create: outside transaction - #{comm_event.connection.outside_transaction?}"
  unless comm_event.comm_evt_purpose_types.first.description.include?("Change Request")
    begin
      CommunicationEventMailer.contact_notification(comm_event).deliver
    rescue => ex
      system_user = Party.find_by_description('Compass AE')
      AuditLog.custom_application_log_message(system_user, ex)
    end
  end
end