Sha256: ee11c438988cc0f46b7244000462dcf0f67ea6817646658967e5ca49b8b71a34

Contents?: true

Size: 941 Bytes

Versions: 5

Compression:

Stored size: 941 Bytes

Contents

module ActiveRecord
  module Bulkoperation
    ActiveRecordVersion = Gem.loaded_specs['activerecord'].version
  end
end

class ActiveRecord::Base
  class << self

    def establish_connection_with_activerecord_bulkoperation(*args)
      establish_connection_without_activerecord_bulkoperation(*args)
      ActiveSupport.run_load_hooks(:active_record_connection_established, connection_pool)
    end
    alias_method :establish_connection_without_activerecord_bulkoperation, :establish_connection
    alias_method :establish_connection, :establish_connection_with_activerecord_bulkoperation
  end
end

ActiveSupport.on_load(:active_record_connection_established) do |connection_pool|
  if !ActiveRecord.const_defined?(:Bulkoperation, false) || !ActiveRecord::Bulkoperation.respond_to?(:load_from_connection_pool)
    require 'activerecord_bulkoperation/base'
  end

  ActiveRecord::Bulkoperation.load_from_connection_pool connection_pool
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
activerecord_bulkoperation-0.2.3 lib/activerecord_bulkoperation.rb
activerecord_bulkoperation-0.2.2 lib/activerecord_bulkoperation.rb
activerecord_bulkoperation-0.2.1 lib/activerecord_bulkoperation.rb
activerecord_bulkoperation-0.2.0 lib/activerecord_bulkoperation.rb
activerecord_bulkoperation-0.1.0 lib/activerecord_bulkoperation.rb