DEV Community

Tim Bogdanov
Tim Bogdanov

Posted on

Request: Linking Postgresql with Rails app

Request on a quick and easy way to link Postgresql with Rails app.

Top comments (4)

Collapse
 
rhymes profile image
rhymes

What operating system do you have? DigitalOcean published at least a guide for Ubuntu Linux and one for MacOS, they are well written:

Collapse
 
timbog80 profile image
Tim Bogdanov

Thank you so much rhymes!

Collapse
 
bobwalsh47hats profile image
Bob Walsh

databases link by convention to a given Rails app via the database.yml file in /config. When starting a new rails app, you set a flag on the rails new command: "rails new" options explained.

For different hosting environments [localhost, heroku, AWS, etc. etc.] it's easier to find their version of databases.yml and go with that.

see this line in the above link: --database=DATABASE] # Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite3/frontbase/ibm_db/sqlserver/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc)

So you would do: rails new myprojectname --database=postgresql

Makes sense?

Collapse
 
timbog80 profile image
Tim Bogdanov

Thank you! yes makes total sense. I've been using the standard database that rails offers out of the box. Currently still learning my ways around rails and thought I could spice some things up.