I have this in my routes.rb:
map.connect “:action/:id”, :controller => “default_controller”
It worked nicely, until I added a second controller to my project. The
new (second) controller is “Admin”.
The problem is I cant reach the actions in the second controller.
http://mysite.com/some_action is routed to some_action in
default_controller. That is how I want it to be. But how do I reach
admin_action in the Admin controller? This doesnt work, for obvious
it gets routed to the undefined action admin in default_controller with
How can I correct this so that
http://mysite.com/some_action is routed to to
http://mysite.com/admin/admin_action is routed to
Routes are processed in the order they’re given in routes.rb, so if you
want to trap the admin controller, give it a route BEFORE the one
/:action’, :controller => ‘default_controller’" etc.
Above that one, put:
map.connect ‘/admin/:action’, :controller => ‘admin’
Put the most specific entries first, and the most general ones at the
bottom. That way you can trap the special cases before they’re resolved
by the general default case.