Forum: Ruby on Rails recognize_path and map.resources

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Cd804cfeeea508f6bf2f5487c9ef4aed?d=identicon&s=25 Jonathan Linowes (Guest)
on 2007-05-14 21:54
(Received via mailing list)
hi,

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

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

but

 >> 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

and

 >> 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?
6a37d700463f35c873eff170bed4eee1?d=identicon&s=25 Tiffani Ashley Bell (Guest)
on 2007-05-15 00: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.