How to change Rails 4.2.4 app config to use Production db instead of Development

0

database.yml

default: &default
  adapter: postgresql
  encoding: unicode
  pool: 5

development:
  <<: *default
  database: pgtest_development

test:
  <<: *default
  database: pgtest_test

production:
  <<: *default
  database: pgtest_production
  username: pgtest
  password: <%= ENV['PGTEST_DATABASE_PASSWORD'] %>

I have deployed my rails app to Digital Ocean but issue is it tries to access the developement database instead of production although live rails app use production database . Production database is already exist still shows Fatal_error:development database not found in rails console. Thank you in advance

Chaitanya Yadav

Posted 2016-08-11T18:21:40.993

Reputation: 1

Answers

0

You need to set RAILS_ENV to production and then start the rails console.

Try this command

bundle exec rails c production

or

RAILS_ENV=production rails c

Deepak Mahakale

Posted 2016-08-11T18:21:40.993

Reputation: 223