突然,rails console
只会使用我的本地数据库,而rails server
会继续使用我的Heroku数据库。为什么会发生这种情况?如何让rails控制台像以前一样使用我的Heroku数据库?
以下是Heroku建议我们做我想做的事情:https://devcenter.heroku.com/articles/connecting-to-heroku-postgres-databases-from-outside-of-heroku#credentials
这使用我的heroku数据库:
DATABASE_URL=$(heroku config:get DATABASE_URL) rails server
这使用我的本地数据库:
DATABASE_URL=$(heroku config:get DATABASE_URL) rails console