I tried ty switch the RACK_ENV and RAILS_ENV environment from development to test by specifying the environment RACK_ENV=test
variable ahead. But it still uses the development database when I type rack db:create
How can I force it to use the test database? (postgres)
You can try to specify ENV["RACK_ENV"]=test
in the app.rb file. As the rack keeps tracking the environment variables by not only your types in the running command but also in the files included in the Rackfile. If you have included app.rb in it. It could override your settings in the command.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.