diff --git a/lib/activerecord-import/base.rb b/lib/activerecord-import/base.rb index 8aeb27c..a9ee246 100644 --- a/lib/activerecord-import/base.rb +++ b/lib/activerecord-import/base.rb @@ -5,10 +5,19 @@ require "active_record/version" module ActiveRecord::Import AdapterPath = File.join File.expand_path(File.dirname(__FILE__)), "/active_record/adapters" + def self.base_adapter(adapter) + case adapter + when 'mysqlspatial' then 'mysql' + when 'spatialite' then 'sqlite3' + 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(AdapterPath,"/abstract_adapter") - require File.join(AdapterPath,"/#{adapter}_adapter") + require File.join(AdapterPath,"/#{base_adapter(adapter)}_adapter") end # Loads the import functionality for the passed in ActiveRecord connection