support rgeo spatial database adapter names

This commit is contained in:
michael groble 2012-02-25 09:36:43 -06:00 committed by Zach Dennis
parent 5f0e220038
commit eec20355e5

View file

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