Skip to main content

How to connect to Remote Postgres database (Rails)

  • Go to heroku and get the database url:

Go to Heroku Click 'Show' to get url

  • URL looks something like this:
postgres://username:password@host_url:port/database_name

  • On your database.yml replace development with this line of code
development: postgres://udo131g0uulkes:p4431656b77845ed6240d42b9e41debf9966903abe9d2cf9ca6d348ea2235debf@ec2-35-169-217-30.compute-1.amazonaws.com:5432/d5cl51aq42aq2q
#development:
#adapter: postgresql
#encoding: unicode
#database: powr_development
#pool: 5
#host: localhost
#prepared_statements: false

  • Open your terminal and rails console
  • Now you are connected to remote heroku database