I am using simple_captcha. It worked find until I add the following line to routes.rb
match ":controller(/:action)", :constraints => {:controller => /sandbox\/[^\/]+/}
The captcha image is not showing and the log shows the following error message.
Started GET "/simple_captcha/8cdf70c193dc8823f281828f11c250e1739883da?time=1294644088" for 127.0.0.1 at Sun Jan 09 23:21:29 -0800 2011
AbstractController::Actio开发者_Go百科nNotFound (The action '8cdf70c193dc8823f281828f11c250e1739883da' could not be found for SimpleCaptchaController):
Why does the line in the routes affect simple_captcha?
Thanks.
Sam
Lets assume the constraint does not exist for now. Given :controller(/:action)
matches and tries to match a particular controller and then an action, the route /simple_captcha/8cdf70c193dc8823f281828f11c250e1739883da
matches simple_captcha
as a controller and 8cdf70c193dc8823f281828f11c250e1739883da
as a action. You could try more of a ":controller/(:id)"
as a route matcher.
I fixed the problem by modifying a line.
From:
match ":controller(/:action)", :constraints => {:controller => /sandbox\/[^\/]+/}
To:
match ":controller(/:action)", :controller => /sandbox\/[^\/]+/
I thought they are the same but obviously they are not. How do they differ?
精彩评论