Module: ActiveRecord::Import

Defined in:
lib/activerecord-import/import.rb,
lib/activerecord-import/base.rb

Overview

:nodoc:

Defined Under Namespace

Modules: AbstractAdapter, ConnectionAdapters, ImportSupport, MysqlAdapter, OnDuplicateKeyUpdateSupport, PostgreSQLAdapter, Sqlite3Adapter Classes: Result

Constant Summary collapse

TIME_COLUMNS =
{
  :create => { "created_on" => tproc ,
               "created_at" => tproc },
  :update => { "updated_on" => tproc ,
               "updated_at" => tproc }
}
TIME_COLUMN_NAMES =
TIME_COLUMNS[:create].keys + TIME_COLUMNS[:update].keys
AdapterPath =
File.join File.expand_path(File.dirname(__FILE__)), "active_record/adapters"

Class Method Summary collapse

Class Method Details

.base_adapter(adapter) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/activerecord-import/base.rb', line 4

def self.base_adapter(adapter)
  case adapter
  when 'mysqlspatial' then 'mysql'
  when 'spatialite' then 'sqlite3'
  when 'postgis' then 'postgresql'
  else adapter
  end
end

.require_adapter(adapter) ⇒ Object

Loads the import functionality for a specific database adapter



14
15
16
17
# File 'lib/activerecord-import/base.rb', line 14

def self.require_adapter(adapter)
  require File.join(AdapterPath, "abstract_adapter")
  require File.join(AdapterPath, "#{base_adapter(adapter)}_adapter")
end