Yes, I have.
I use two VM on vagrant, one for the Postgres and another one for the app. Here is my database.yml

``yaml
development: &development
  adapter      : postgresql
  encoding     : unicode
  database     : swagexpert_development
  template     : template0
  pool         : 5
  min_messages : warning
  host         : <%= ENV['DATABASE_HOST'] %>

test: &test
  <<: *development
  database     : swagexpert_test

staging: &staging
  <<: *development
  database     : swagexpert_staging

production: &production
  <<: *development
  database     : swagexpert_production

```

The `DATABASE_HOST` variable has the IP of my `db` VM.