Sha256: f4ca5bd39d10ec74318d4b3ea3afe85eb7bc2acd58951a1964da32900ec58362

Contents?: true

Size: 876 Bytes

Versions: 12

Compression:

Stored size: 876 Bytes

Contents

# A TransactionObject belongs to a connection. It's like a singleton for each transaction.
#
# Author:: Andre Kullmann
#
module ActiveRecord
  module Bulkoperation
    module Util    
      class TransactionObject
        def self.get
          result = ActiveRecord::Base.connection.connection_listeners.select { |l| l.class == self }.first
          unless result
            result = new
            ActiveRecord::Base.connection.connection_listeners << result
          end
          result
        end

        def after_commit
          close
          ActiveRecord::Base.connection.connection_listeners.delete(self)
        end

        def after_rollback
          close
          ActiveRecord::Base.connection.connection_listeners.delete(self)
        end

        def after_rollback_to_savepoint
        end

        def close
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
activerecord_bulkoperation-0.2.3 lib/activerecord_bulkoperation/util/transaction_object.rb
activerecord_bulkoperation-0.2.2 lib/activerecord_bulkoperation/util/transaction_object.rb
activerecord_bulkoperation-0.2.1 lib/activerecord_bulkoperation/util/transaction_object.rb
activerecord_bulkoperation-0.2.0 lib/activerecord_bulkoperation/util/transaction_object.rb
activerecord_bulkoperation-0.1.0 lib/activerecord_bulkoperation/util/transaction_object.rb
activerecord_bulkoperation-0.0.8 lib/activerecord_bulkoperation/util/transaction_object.rb
activerecord_bulkoperation-0.0.7 lib/activerecord_bulkoperation/util/transaction_object.rb
activerecord_bulkoperation-0.0.6 lib/activerecord_bulkoperation/util/transaction_object.rb
activerecord_bulkoperation-0.0.5 lib/activerecord_bulkoperation/util/transaction_object.rb
activerecord_bulkoperation-0.0.4 lib/activerecord_bulkoperation/util/transaction_object.rb
activerecord_bulkoperation-0.0.3 lib/activerecord_bulkoperation/util/transaction_object.rb
activerecord_bulkoperation-0.0.2 lib/activerecord_bulkoperation/util/transaction_object.rb