I''m using edge rails. My routes.rb is: map.connect '':controller/service.wsdl'', :action => ''wsdl'' # Install the default route as the lowest priority. map.connect '':controller/:action/:id'' map.resources :team <---- THIS LINE ADDED BY ME Also have a team_controller.rb, a team.rb model and scaffolding for it. If I invoke /team/1;edit url it shows me the edit form for team 1, that''s right. But if I invoke /team/1 I receive the response: Unknown action No action responded to 1 Why it didn''t show me the team 1? -- Posted via http://www.ruby-forum.com/.
thats because rails priorizes routes. the first matching route is taken, so in your routes, its the standard route, and controller team, action 1 is called. move the resources up before all other routes and everything should work 2006/8/14, Eduardo Y??ez Parareda <eduardo.yanez@gmail.com>:> > I''m using edge rails. > > My routes.rb is: > > map.connect '':controller/service.wsdl'', :action => ''wsdl'' > > # Install the default route as the lowest priority. > map.connect '':controller/:action/:id'' > > map.resources :team <---- THIS LINE ADDED BY ME > > Also have a team_controller.rb, a team.rb model and scaffolding for it. > > If I invoke /team/1;edit url it shows me the edit form for team 1, > that''s right. But if I invoke /team/1 I receive the response: > > Unknown action > No action responded to 1 > > Why it didn''t show me the team 1? > > > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Michael Siebert <info@siebert-wd.de> www.stellar-legends.de - Weltraum-Browsergame im Alpha-Stadium -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060814/44e642c8/attachment.html
Eduardo Y??ez Parareda wrote:> I''m using edge rails. > > My routes.rb is: > > map.connect '':controller/service.wsdl'', :action => ''wsdl'' > > # Install the default route as the lowest priority. > map.connect '':controller/:action/:id'' > > map.resources :team <---- THIS LINE ADDED BY ME > > Also have a team_controller.rb, a team.rb model and scaffolding for it. > > If I invoke /team/1;edit url it shows me the edit form for team 1, > that''s right. But if I invoke /team/1 I receive the response: > > Unknown action > No action responded to 1 > > Why it didn''t show me the team 1?In routes.rb "map.connect '':controller/:action/:id''" is the catch all of your routes. When a request comes in, rails tries to find a in your routes file by going route by routes form the top to the bottom. So as soon as it finds a match, it stops looking. So "/team/1" matches ":controller/:action/:id" as controller "team" and action "1". So if you put the map.resources line above your other stuff it will work as intended and match against the resource routes rather than the default route. This is also why this comment is there: # Install the default route as the lowest priority. It''s telling you too keep that route at the bottom so it doesn;t interfere with any other routes. -- Posted via http://www.ruby-forum.com/.