Sha256: 6aae92308982d86f1d7891faeb0bda380034674dfce65582c278d8c90e3b6934

Contents?: true

Size: 692 Bytes

Versions: 3

Compression:

Stored size: 692 Bytes

Contents

class ActiveRecord::Base
  class << self
    def establish_connection_with_activerecord_import(*args)
      establish_connection_without_activerecord_import(*args)
      ActiveSupport.run_load_hooks(:active_record_connection_established, connection_pool)
    end
    alias_method_chain :establish_connection, :activerecord_import
  end
end

ActiveSupport.on_load(:active_record_connection_established) do |connection_pool|
  if !ActiveRecord.const_defined?(:Import) || !ActiveRecord::Import.respond_to?(:load_from_connection_pool)
    require File.join File.dirname(__FILE__),  "activerecord-import/base"
  end
  ActiveRecord::Import.require_adapter connection_pool.spec.config[:adapter]
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
Empact-activerecord-import-0.4.3 lib/activerecord-import.rb
Empact-activerecord-import-0.4.1 lib/activerecord-import.rb
Empact-activerecord-import-0.4.0 lib/activerecord-import.rb