support rgeo spatial database adapter names
This commit is contained in:
parent
5f0e220038
commit
eec20355e5
|
@ -5,10 +5,19 @@ require "active_record/version"
|
||||||
module ActiveRecord::Import
|
module ActiveRecord::Import
|
||||||
AdapterPath = File.join File.expand_path(File.dirname(__FILE__)), "/active_record/adapters"
|
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
|
# Loads the import functionality for a specific database adapter
|
||||||
def self.require_adapter(adapter)
|
def self.require_adapter(adapter)
|
||||||
require File.join(AdapterPath,"/abstract_adapter")
|
require File.join(AdapterPath,"/abstract_adapter")
|
||||||
require File.join(AdapterPath,"/#{adapter}_adapter")
|
require File.join(AdapterPath,"/#{base_adapter(adapter)}_adapter")
|
||||||
end
|
end
|
||||||
|
|
||||||
# Loads the import functionality for the passed in ActiveRecord connection
|
# Loads the import functionality for the passed in ActiveRecord connection
|
||||||
|
|
Loading…
Reference in a new issue