Rails rails3.0 中 routingerror 等错误的处理与 SimpleCaptcha 的冲突

pokkalee · December 28, 2011 · 2634 hits

在 rails3.0 中,并不能捕获到 RoutingError,UnknowAction 等,而我使用了 [http://techoctave.com/c7/posts/36-rails-3-0-rescue-from-routing-error-solution] 这个方法

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

,但好像仍然事无法处理到 UnknowAction 这种情况 orz;

正题是,添加路由后会与 SimpleCaptcha 产生冲突,使验证码图片因路由导向而显示不能,在 routes 添加 [http://expressica.com/simple_captcha/]

ActionController::Routing::Routes.draw do |map|  
  map.simple_captcha '/simple_captcha/:action', :controller => 'simple_captcha'  
end 

路由代码后却导致了 AbstractController::ActionNotFound 问题仍然是无法显示图片. 我想到的解决方法是写路由来命中 simplecaptcha 的请求,但这个写法是官方提出的应该事适用性比较高的了,我该如何配置路由? 或者我使用其他方法来捕获这类 error?或者使用其他方法达到类似的目的? 有没遇到过类似情况的大大指教下, thx

No Reply at the moment.
You need to Sign in before reply, if you don't have an account, please Sign up first.