資料庫.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'] %>
我已將 Rails 應用程式部署到 Digital Ocean,但問題是它嘗試存取開發資料庫而不是生產資料庫,儘管即時 Rails 應用程式使用生產資料庫。生產資料庫已經存在,仍然顯示Fatal_error:development database not found
在 Rails 控制台中。先感謝您
答案1
你需要設定RAILS_ENV
到production
然後啟動rails console
。
試試這個命令
bundle exec rails c production
或者
RAILS_ENV=production rails c