你如何处理Rails中的这种路由错误

时间:2013-01-05 12:33:50

标签: ruby-on-rails rails-routing

我偶尔会在日志文件中看到这样的错误,我该如何处理呢。

Started GET "/w00tw00t.at.ISC.SANS.Win32:)" for 69.25.37.166 at 2013-01-02 00:06:05 +0000

ActionController::RoutingError (No route matches [GET] "/w00tw00t.at.ISC.SANS.Win32:)"):
  actionpack (3.2.6) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  actionpack (3.2.6) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  railties (3.2.6) lib/rails/rack/logger.rb:26:in `call_app'
  railties (3.2.6) lib/rails/rack/logger.rb:16:in `call'
  actionpack (3.2.6) lib/action_dispatch/middleware/request_id.rb:22:in `call'
  rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
  rack (1.4.1) lib/rack/runtime.rb:17:in `call'
  activesupport (3.2.6) lib/active_support/cache/strategy/local_cache.rb:72:in `call'

1 个答案:

答案 0 :(得分:0)

尝试这样的事情:

<强>的routes.rb

match '*a', :to => 'errors#routingIssue'

创建错误控制器 - errors_controller.rb

class ErrorsController < ApplicationController
  def routingIssue
    render_404
  end
end