2

在我rails2.3.11app/controllers/application_controller.rb我有这个ActionDispatch :: ShowExceptions - 轨升级2.3.x版本到3.2.x中

ActionDispatch::ShowExceptions::rescue_responses["ActionController::RoutingError"] = :not_found 

现在这个功能在轨-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具体的帮助,所以我不能让过时的警告。

回答

3

添加以下行

config.action_dispatch.rescue_responses["ActionController::RoutingError"] = :not_found 

,或者你可以

config.action_dispatch.rescue_responses.merge!('ActionController::RoutingError' => :not_found) 

config/environments/ ENV文件,你应该能够增加(production.rb,development.rb或test.rb)或config/application.rb为所有环境

请让我知道这是否适合你

+0

这个d不为我工作。 – jnevelson 2013-03-08 00:22:26

+0

@jnevelson,请粘贴您的代码 – 2013-03-08 06:12:44