Follow the instructions in the installation guide below that corresponds to your operating system:
You can find all installation options for a variety of operating systems on the official PostgreSQL download page.
By default the application is configured to connect to a local database named
PracticalDeveloper_development. If you need to specify a username and a password you can go about it two ways: using the environment variable
DATABASE_URL with a connection string (preferred method) or modifying the file
The official Rails guides go into depth on how Rails merges the existing
database.yml with the connection string.
Add the following:
USERNAMEwith your database username,
PASSWORDwith your database password.
You can find more details on connection strings in PostgreSQL's own documentation.
NOTE: due to how Rails merges
DATABASE_URL it's recommended not to add the database name in the connection string. This will default to your development database name also during tests, which will effectively empty the development DB each time tests are run.
The other option is to change the
database.yml file with
1 2 3 4 5 6 7 8
development: <<: *default username: USERNAME password: PASSWORD test: <<: *default username: USERNAME password: PASSWORD
Keep in mind not to commit your modified
database.yml containing your credentials under any circumstances to any repository.
postgresql connection timeout. Go to your
spec/support/database_cleaner.rbfile. And rename
Please, do not commit `databasecleaner.rb` to the repository either._