Ruby on Rails — Onkey Website Project

Install Postgres

Before getting started, make sure to download the Postgre for macOS from the official website.

Update Gemfile

Remove sqlite3:

# Use sqlite3 as the database for Active Record
gem 'sqlite3'

And add Postgres:

# Use Postgres as the database for Active Record
gem 'pg'

Once you’ve updated your Gemfile, run bundle install to update your Gemfile.lock file.

Edit files

Change settings in config/database.yml

default: &default
adapter: postgresql
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000
development:
<<: *default
database: onkey_website_development
test:
<<: *default
database: onkey_website_test
production:
<<: *default
database: onkey_website_production
  • Run rake db:create
  • Run rake db:migrate
  • Run rake db:seed(if you have a seed file)

All Set!

--

--