2011-01-10 133 views
0

我正在使用simple_captcha。它的工作发现,直到我添加以下行的routes.rb奇怪的轨道3路线问题

match ":controller(/:action)", :constraints => {:controller => /sandbox\/[^\/]+/} 

验证码图片没有显示和日志显示以下错误消息。

Started GET "/simple_captcha/8cdf70c193dc8823f281828f11c250e1739883da?time=1294644088" for 127.0.0.1 at Sun Jan 09 23:21:29 -0800 2011 

AbstractController::ActionNotFound (The action '8cdf70c193dc8823f281828f11c250e1739883da' could not be found for SimpleCaptchaController): 

为什么路由中的行会影响simple_captcha?

谢谢。

山姆

回答

0

让我们假设约束现在不存在。给定:controller(/:action)匹配并尝试匹配特定的控制器,然后执行操作,则路由/simple_captcha/8cdf70c193dc8823f281828f11c250e1739883dasimple_captcha作为控制器,将8cdf70c193dc8823f281828f11c250e1739883da作为操作匹配。你可以尝试更多的":controller/(:id)"作为路由匹配器。

0

我通过修改一行来解决了这个问题。

来源:

match ":controller(/:action)", :constraints => {:controller => /sandbox\/[^\/]+/} 

要:

match ":controller(/:action)", :controller => /sandbox\/[^\/]+/ 

我还以为他们是一样的,但显然事实并非如此。他们有什么不同?