Sha256: dca6bb3c08b7667805460d14cf53453c9fcdec5745f1bd25161ea624ac082145

Contents?: true

Size: 1.09 KB

Versions: 8

Compression:

Stored size: 1.09 KB

Contents

require "pathname"
require "active_record"
require "active_record/version"

module ActiveRecord::Import
  ADAPTER_PATH = "activerecord-import/active_record/adapters".freeze

  def self.base_adapter(adapter)
    case adapter
    when 'mysql2_makara' then 'mysql2'
    when 'mysql2spatial' then 'mysql2'
    when 'spatialite' then 'sqlite3'
    when 'postgresql_makara' then 'postgresql'
    when 'makara_postgis' then 'postgresql'
    when 'postgis' then 'postgresql'
    else adapter
    end
  end

  # Loads the import functionality for a specific database adapter
  def self.require_adapter(adapter)
    require File.join(ADAPTER_PATH, "/#{base_adapter(adapter)}_adapter")
  rescue LoadError
    # fallback
  end

  # Loads the import functionality for the passed in ActiveRecord connection
  def self.load_from_connection_pool(connection_pool)
    require_adapter connection_pool.spec.config[:adapter]
  end
end

require 'activerecord-import/import'
require 'activerecord-import/active_record/adapters/abstract_adapter'
require 'activerecord-import/synchronize'
require 'activerecord-import/value_sets_parser'

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
activerecord-import-1.0.1 lib/activerecord-import/base.rb
activerecord-import-1.0.0 lib/activerecord-import/base.rb
activerecord-import-0.28.2 lib/activerecord-import/base.rb
activerecord-import-0.28.1 lib/activerecord-import/base.rb
activerecord-import-0.28.0 lib/activerecord-import/base.rb
activerecord-import-0.27.0 lib/activerecord-import/base.rb
activerecord-import-0.26.0 lib/activerecord-import/base.rb
activerecord-import-0.25.0 lib/activerecord-import/base.rb