First, if an ERROR occurs in the development environment, detailed information will be displayed on the browser.
However, in the production environment, even if some kind of ERROR occurs, "We're sorry, but something went wrong." Is displayed.
Therefore, to display detailed information on the browser even in the production environment
You can change config.consider_all_requests_local = false
to true
.
config/environments/production.rb
config.consider_all_requests_local = true
Rails docs (https://railsdoc.com/page/config_consider_all_requests_local)
In the production environment of Rails 5 or later, a function to prevent the execution of DB-destroying commands such as db: drop and db: reset has been added.
Therefore, even if you do bundle exec rake db: migrate: reset RAILS_ENV = production
etc. in the production environment, an error will occur.
You can specify DISABLE_DATABASE_ENVIRONMENT_CHECK = 1
in the environment variable.
$ bundle exec rake db:migrate:reset RAILS_ENV=production DISABLE_DATABASE_ENVIRONMENT_CHECK=1
Rails5 production does not allow rake db: drop, normally
By reading through the following sites, you may find a clue to the solution when you get stuck in the production environment. Read under Rails config / environments
Recommended Posts