在我的 rails2.3.11 app/controllers/application_controller.rb
中,我有这个
ActionDispatch::ShowExceptions::rescue_responses["ActionController::RoutingError"] = :not_found
现在此功能已在 rails-3.2.11 中弃用,我正在获取此服务器日志
DEPRECATION WARNING: ActionDispatch::ShowExceptions.rescue_responses is deprecated. Please configure your exceptions using a railtie or in your application config instead. (called from ApplicationController at /home/mbussey/demo/app/controllers/application_controller.rb:31)
可能我的问题是重复的,但我需要有关如何在 Rails3.2.11 中设置 ActionDispatch::ShowExceptions::rescue_responses
的具体帮助,因此我无法收到已弃用的警告。
最佳答案
添加以下行
config.action_dispatch.rescue_responses["ActionController::RoutingError"] = :not_found
或者你也可以
config.action_dispatch.rescue_responses.merge!( 'ActionController::RoutingError' => :not_found)
在 config/environments/
env 文件中,您应该能够添加(生产.rb、development.rb 或 test.rb)或 config/application.rb
所有环境
请告诉我这是否适合您
关于ruby-on-rails - ActionDispatch::ShowExceptions - Rails 升级 2.3.x 到 3.2.x,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14901374/