How to correctly setup a database.yml file in Rails 4

前端 未结 1 2030
傲寒
傲寒 2021-02-20 00:24

I\'m curious how to correctly set up my database.yml file in a Rails 4 application.

It\'s not something I have really looked into in great detail as it all

1条回答
  •  渐次进展
    2021-02-20 00:57

    The second database.yml you posted is actually equivalent to the first, it just copies values from the development block.

    To answer your other questions:

    1) Should I be setting usernames and passwords in ALL environments

    you can if you wish, or you can leave it as you have above where it takes the credentials all from one block.

    2)If I'm using clear DB with Heroku as my database then should I be uncommenting

    heroku actually completely disregards this file (which shouldn't be checked into source control in the first place anyway). Heroku has its own mechanism to handle databases which you can read more about here: https://devcenter.heroku.com/articles/heroku-postgresql

    Essentially, treat "heroku's databases" and local databases that you define in this file completely different.

    0 讨论(0)
提交回复
热议问题