Database connections in ruby are defined within the database.yml file. Unfortunately this is not really documented because each adapter has its own options to support the underlying database.
First thing you should not forget: ruby does use libpg - so any feature that is not provided by this library will not work within ruby. At the other hand: if you can connect with psql to your database, chances are good, that you can do it with ruby too.
Here is a list of options you can use in database.yml if you are using postgresql adapter:
this is the hostname of the server which runs the postgresql instance
this is the same as host but name resolve is not used, use this for raw ip addresses
the port of the postgresql instance
name of postgresql database
username (don't forget to configure pg_hba.conf so that this user is allowed to connect)
password for the username
specify the sslmode of the connection:
- disable only use allow unencryted connections
- allow use unencrypted first and if that fails try ssl
- prefer first try ssl first but use unencrypted if ssl does not work
- require use ssl or fail connection
maximum wait for the connection (in seconds), specify 0 to wait indefinitely
the service name of the corresponding kerberos
GSS library to use for GSS API
service which references pg_service.conf
You always use <parameter> : <value> format
If you want to use a SSL encrypted connection, you should add sslmode:require to your database stanza in database.yml.