This project is archived and is in readonly mode.

#1406 ✓resolved
Evgeniy Pirogov

Only get, head, post, put, and delete requests are allowed. Route was not recognized. Try to find out why (maybe wrong verb). do not pass all relevant information to route.recognize as it does to recognize_optimized

Reported by Evgeniy Pirogov | November 18th, 2008 @ 07:25 PM | in 2.x

class RouteSet
  def recognize_path(path, environment={})
    result = recognize_optimized(path, environment) and return result

    # Route was not recognized. Try to find out why (maybe wrong verb).
    allows = HTTP_METHODS.select { |verb| routes.find { |r| r.recognize(path, environment.merge(:method => verb)) } }

    if environment[:method] && !HTTP_METHODS.include?(environment[:method])
      raise NotImplemented.new(*allows)
    elsif !allows.empty?
      raise MethodNotAllowed.new(*allows)
    else
      raise RoutingError, "No route matches #{path.inspect} with #{environment.inspect}"
    end
  end

line

     allows = HTTP_METHODS.select { |verb| routes.find { |r| r.recognize(path, :method => verb) } }

should read

     allows = HTTP_METHODS.select { |verb| routes.find { |r| r.recognize(path, environment.merge(:method => verb)) } }

this way environment passed to routes rules

otherwise hostname_routing stop working as there is no information passed to check hostname http://weblog.jamisbuck.org/2006...

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Attachments