3 ms·
You probably know this already, but I'd like to clarify for future readers: The one configuration file you have to set up when you first start a Rails project
by palish 19y ago
You probably know this already, but I'd like to clarify for future readers:
The one configuration file you have to set up when you first start a Rails project is database.yml. It tells Rails how to talk to your database. There are two fields for you to fill in, "database" and "password". The rest of the fields are filled in automatically.
Here's an example database.yml file. Notice that it has three environments (development, production, and test), and that different databases are used for each. If you're developing your application, you're using yourapp_dev. Rails uses yourapp_test during unit testing:
common: &common
adapter: mysql
host: localhost
username: root
password: somepassword
development:
database: yourapp_dev
<<: *common
production:
database: yourapp_prod
<<: *common
test:
database: yourapp_test
<<: *common