method
postgresql_connection
rails latest stable - Class:
ActiveRecord::Base
Method deprecated or moved
This method is deprecated or moved on the latest stable version. The last existing version (v3.2.13) is shown here.
postgresql_connection(config)public
Establishes a connection to the database that’s used by all Active Record objects
# File activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb, line 13
def self.postgresql_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::PostgreSQLAdapter.new(nil, logger, [host, port, nil, nil, database, username, password], config)
end Related methods
- Instance methods
- <=>
- ==
- connection
- dup
- encode_with
- eql?
- freeze
- frozen?
- hash
- init_with
- initialize_dup
- inspect
- readonly!
- readonly?
- to_yaml
- yaml_initialize
- Class methods
- ===
- arel_engine
- arel_table
- clear_active_connections!
- configurations
- connected?
- connection
- connection_config
- connection_handler
- connection_id
- connection_id=
- connection_pool
- default_timezone
- establish_connection
- generated_feature_methods
- inherited
- initialize_generated_modules
- inspect
- logger
- mysql2_connection
- mysql_connection
- new
- postgresql_connection
- remove_connection
- retrieve_connection
- schema_format
- sqlite3_connection
- timestamped_migrations
- Private methods
-
relation -
to_ary