Reputation: 159
I am new to Rails and trying to understand the app directory structure of Rails. In this I came across database.yml in config folder. But we have a separate db folder, then why is .yml file in config folder? Thanks in advance.
Upvotes: 0
Views: 780
Reputation: 815
config
As the name suggests this contains all the application’s configuration files. The database connection and application behavior can be altered by the files inside this directory.
config/database.yml
This file holds all the database configuration the application needs. Here, different configurations can be set for different environments.
So, all the configuration related task is done under config directory.
Upvotes: 1
Reputation: 115
Because you use the database.yml file to configure your database. For example if you wish to change your main database from Sql Lite(default) to Mysql, you need to change your database configuration, which is found in your database.yml file.
Upvotes: 1
Reputation: 776
Because database.yml
contains config for your DB setup and Rails convention requires that all configs are in config
folder :) This way you don't need to search the whole project for config of a new gem you just installed - all configs are always in the same folder.
Upvotes: 0