In the rails code comments it suggests that
Route#recognition_conditions may be redefined by a plugin to allow
for routing to depend on different and new conditions. You also
modify the creation of the environment data (a hash) that feeds
this in RouteSet#extract_request_environment.
I have a plugin that does this so that I can base routing
decisions on the query string passed in the request (yeh, it may
not necessarily be rfc compliant to do that, but I do need it).
Rails incorrectly raises NotImplemented errors when the route
(with the extra conditions) does not match rather than RoutingError
because the extra environment is not passed on to route recognition
when testing for other HTTP verbs that might work (so those
recognition tests might pass when they shouldn't).
This requires a one line fix in recognition_optimisation.rb
Change this:
allows = HTTP_METHODS.select {|verb| routes.find {|r| r.recognize(path, :method => verb)}}
To this:
allows = HTTP_METHODS.select {|verb| routes.find {|r| r.recognize(path, environment.merge(:method => verb))}}
I attach a patch for this.