iltempo
iltempo

Reputation: 16012

Easy way to re-generate default database.yml in a Rails project

It is a general best practice to not track the config/database.yml file in version control system (p.e. git). If I clone a project this file is missing and has to be re-created. I did so by copying for another project in the past.

Is there an easier way? Using a generator for instance?

Upvotes: 0

Views: 1608

Answers (1)

R Milushev
R Milushev

Reputation: 4315

You could try naming the file database.yml.example , keeping it in the version control . Then you should instruct Capistrano to copy database.yml.example to database.yml . Anyway , it'll better if you move your usernames , passwords , secret tokens etc. to environmental variables . Then in your *.yml files (in case of open-source project ) people will see :

username: ENV["USERNAME"]
password: ENV["PASSWORD"]

Ryan Bates explains all the steps in this Railscast .

Upvotes: 2

Related Questions