Rails:关闭错误显示 [英] Rails: Turn off error display
本文介绍了Rails:关闭错误显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我通过 URL /posts/13
访问 Rails 项目中不存在的帖子时,浏览器显示详细错误:
When I access a post that doesn't exist in my Rails project via the URL /posts/13
, the browser shows a verbose error:
ActiveRecord::RecordNotFound in PostsController#show
Couldn't find Post with ID=13
Rails.root: ...
...
Request
Parameters:
{"id"=>"13"}
...
有没有办法关闭这个详细的错误显示?
Is there a way to turn this detailed error display off?
推荐答案
试试这个:
在生产环境中运行服务器
$ rails s -e production
移除ActionDispatch::DebugExceptions中间件
config.middleware.delete(ActionDispatch::DebugExceptions)
在您的环境配置中设置 config.think_all_requests_local = false
set config.consider_all_requests_local = false
in your environment config
这篇关于Rails:关闭错误显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文