I’ve found the easiest way to manage the config/database.yml file in a Rails + Capistrano configuration is to add the following line to your capistrano config/deploy.rb configuration file:
set :linked_files, %w{config/database.yml}
Then add config/database.yml to your .gitignore file.
After which, add your environment’s database.yml file to the appropriate location on the remote server(s):
#{deploy_to}/appname/shared/config/database.yml
Where deploy_to is the deploy_to capistrano configuration setting.
This way the configuration parameters are not stored in your repository, but they are still easily updated if needed.