Sha256: 1affb9d028cf716dcb5ff9af0b3ded364e18b76b53282f03a128207905b82312

Contents?: true

Size: 538 Bytes

Versions: 1

Compression:

Stored size: 538 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.include AfterCommitExceptionNotification::CommittedWithNotification

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
after_commit_exception_notification-0.1.0 lib/after_commit_exception_notification.rb