Forum: Ruby on Rails recognize_path and map.resources

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Jonathan L. (Guest)
on 2007-05-14 23:54
(Received via mailing list)

in script/console, when i do
    >> rs = ActionController::Routing::Routes
           >> puts rs.routes

the list includes
     GET    /projects/
{:controller=>"projects", :action=>"index"}


 >> rs.recognize_path "/projects/"
ActionController::RoutingError: no route found to match "/projects/"
with {}
         from /opt/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/routing.rb:1292:in `recognize_path'
         from (irb):27
         from :0


 >> rs.generate :controller => "project"
ActionController::RoutingError: No route matches
{:controller=>"project", :action=>"index"}
         from /opt/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/routing.rb:1266:in `generate'
         from (irb):26
         from :0

same with my other controllers
but it works for named routes defined with map.connect and with map.*

what am i missing?
Tiffani Ashley B. (Guest)
on 2007-05-15 02:43
(Received via mailing list)
For rs.recognize_path "/projects/", it'd be helpful to include the HTTP
method.  So...something like
    rs.recognize_path "/projects/", :method => :get
should work.

-Tiffani A.B.
This topic is locked and can not be replied to.