How to find the URL path to a local postgres database?
postgresql, ruby-on-rails
Solution
The format appears to be
postgres://username:password@host/database
You have a `/` in your database name and (apparently) postgres will accept `/` in database names, so you need to use either
postgres:///db/database-name
or
postgres:///db%2Fdatabase-name
Feel free to take out the `db/` part of your database name - it's only warranted for databases like SQLite that store the db in a local file and need a filename.
Problem
I have a Rails app running on a postgres database. I'm setting up a background task queue running on the database, and I need to specify the database URL. The various permutations I've tried and would expect all return `FATAL: database "database-name" does not exist`. Is there a command that will print this URL? Or, what should the URL look like if my database.yml looks like this ``` development: adapter: postgresql encoding: unicode database: db/database-name ``` Thanks for suggestions.