Sha256: a62cda90ebea19b864578000636864e0c158f0ac20f9affc63d82a7b48241b1c

Contents?: true

Size: 545 Bytes

Versions: 1

Compression:

Stored size: 545 Bytes

Contents

require "active_record"

module AfterCommitExceptionNotification
  def self.callback(exception = nil, &block)
    if block
      @block = block
    else
      @block.call(exception)
    end
  end

  module CommittedWithNotification
    def committed!
      super
    rescue Exception => e # same as active_record/connection_adapters/abstract/database_statements.rb:370
      AfterCommitExceptionNotification.callback(e)
      raise
    end
  end
end

ActiveRecord::Base.send :include, AfterCommitExceptionNotification::CommittedWithNotification

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
after_commit_exception_notification-0.1.1 lib/after_commit_exception_notification.rb