This project is archived and is in readonly mode.
Possible routing bug
-
Yehuda Katz (wycats)
- State changed from new to invalid
Rails specifically raises a MethodNotAllowed in this case to mirror the HTTP error codes http://en.wikipedia.org/wiki/List_of_HTTP_status_codes specifically, 405
-
Steven Hartland
I would be inclined to agree for a none wild card path, but with the current behaviour is impossible to catch the total wild card case for a specific method request, without effectively breaking standard 404 behaviour for the instance.
It may be that an additional directive to the route, possibly within :conditions, could be used to indicate if a match to the rule but not the method should result in NotFound or MethodNotAllowed.
An example of this could be:
map.connect '*path', :controller => 'fixes', :action => 'options_for_mopd', :conditions => { :method => :options, :match_method => true }Either way it would be a good idea to make it clear in the docs of ActionController::Routing as the current statement:
"With conditions you can define restrictions on routes." Indicates that conditions "restrict" the matching of a route, which is not the case; the route matches but is bypassed in a post filter by the condition, hence facilitating MethodNotAllowed / 405 functionaility, if the path matches but the method does not.For completeness if anyone reading this is looking for a workaround, you can do this by adding a second catch all route without a :method condition that generates 404 e.g
map.nofile '*path', :controller => 'fixes', :action => 'do404'