support rgeo spatial database adapter names

master
michael groble 2012-02-25 09:36:43 -06:00 committed by Zach Dennis
parent 5f0e220038
commit eec20355e5
1 changed files with 10 additions and 1 deletions

View File

@ -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