Sha256: dd95293b1f315ed1f3739f7764cf9cd1cb83c81ff1f7522eac547860debc8883
Contents?: true
Size: 1020 Bytes
Versions: 1
Compression:
Stored size: 1020 Bytes
Contents
require 'pg' class ::ActiveRecord::Base # ActiveRecord looks for the postgis_connection factory method in # this class. # # Based on the default `postgresql_connection` definition from # activerecord's: # lib/active_record/connection_adapters/postgresql_adapter.rb def self.postgis_connection(config_) config_ = config_.symbolize_keys host_ = config_[:host] port_ = config_[:port] || 5432 username_ = config_[:username].to_s if config_[:username] password_ = config_[:password].to_s if config_[:password] if config_.key?(:database) database_ = config_[:database] else raise ::ArgumentError, "No database specified. Missing argument: database." end # The postgres drivers don't allow the creation of an unconnected PGconn object, # so just pass a nil connection object for the time being. ::ActiveRecord::ConnectionAdapters::PostGISAdapter::MainAdapter.new(nil, logger, [host_, port_, nil, nil, database_, username_, password_], config_) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
activerecord-postgis-adapter-0.5.1 | lib/active_record/connection_adapters/postgis_adapter/pg_connection.rb |