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