Class: ActiveRecord::Base
- Inherits:
-
Object
- Object
- ActiveRecord::Base
- Defined in:
- lib/active_record/connection_adapters/redshiftbulk_adapter.rb
Class Method Summary collapse
-
.redshift_connection(config) ⇒ Object
Establishes a connection to the database that’s used by all Active Record objects.
Class Method Details
.redshift_connection(config) ⇒ Object
Establishes a connection to the database that’s used by all Active Record objects
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/active_record/connection_adapters/redshiftbulk_adapter.rb', line 13 def self.redshift_connection(config) # :nodoc: 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. ConnectionAdapters::RedshiftBulkAdapter.new(nil, logger, [host, port, nil, nil, database, username, password], config) end |