gpt4 book ai didi

ruby-on-rails - rails : Turn off error display

转载 作者:数据小太阳 更新时间:2023-10-29 07:23:59 25 4
gpt4 key购买 nike

当我通过 URL /posts/13 访问我的 Rails 项目中不存在的帖子时,浏览器显示详细错误:

ActiveRecord::RecordNotFound in PostsController#show

Couldn't find Post with ID=13
Rails.root: ...
...
Request

Parameters:

{"id"=>"13"}
...

有没有办法关闭这个详细的错误显示?

最佳答案

试试这个:

  • 在生产环境中运行服务器 $ rails s -e production

  • 移除 ActionDispatch::DebugExceptions 中间件

    config.middleware.delete(ActionDispatch::DebugExceptions)

  • 在您的环境配置中设置 config.consider_all_requests_local = false

关于ruby-on-rails - rails : Turn off error display,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12849597/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com