database.yml YAML questions

I'm no YAML expert but I think when you use "database: *app_prod" it will be looking for %app_prod to be defined somewhere, and isn't going to pick up on &app.

You can however use erb in your YAML like so:

production:
   <<: &login
   database: <%= puts '#{app_name}_prod'%>