Sha256: 83711571db88504ff39d8af45e093128d00a206c03a376b8e961a967c70b25ee
Contents?: true
Size: 1.72 KB
Versions: 1
Compression:
Stored size: 1.72 KB
Contents
module ActiveRecord module Bulkoperation module AbstractAdapter module InstanceMethods def self.included(base) base.class_eval do alias_method :commit_db_transaction_without_callback, :commit_db_transaction alias_method :rollback_db_transaction_without_callback, :rollback_db_transaction alias_method :rollback_to_savepoint_without_callback, :rollback_to_savepoint alias_method :create_savepoint_without_callback, :create_savepoint def commit_db_transaction connection_listeners.each { |l| l.before_commit if l.respond_to?('before_commit') } commit_db_transaction_without_callback connection_listeners.each { |l| l.after_commit if l.respond_to?('after_commit') } end def rollback_db_transaction rollback_db_transaction_without_callback connection_listeners.each { |l| l.after_rollback if l.respond_to?('after_rollback') } end def rollback_to_savepoint(name = current_savepoint_name) rollback_to_savepoint_without_callback(name) connection_listeners.each { |l| l.after_rollback_to_savepoint if l.respond_to?('after_rollback_to_savepoint') } end def create_savepoint(name = current_savepoint_name) connection_listeners.each { |l| l.before_create_savepoint if l.respond_to?('before_create_savepoint') } create_savepoint_without_callback(name) end end end def connection_listeners @connection_listeners ||= [] end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
activerecord_bulkoperation-0.0.2 | lib/activerecord_bulkoperation/adapters/abstract_adapter.rb |