Search code examples
ruby-on-railsdirectory-structure

Why is `database.yml` file in config folder, rather than in db folder in ruby on rails?


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.


Solution

  • 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.