I have a question about a default route within a namespace.
I use the line
map.root :controller => ‘home’
to redirect requests to the root of my website to the ‘home’
controller, which works fine.
I also have a controller within the ‘admin’ namespace, defined like
class Admin::UsersController < ApplicationController
So I can access this controller like this: example.com/admin/users
which also works fine.
However, I’m thinking that I’m going to have several controllers
within the admin namespace, so what I would like to do is be able to
go to example.com/admin and have a default controller within the admin
namespace (even if it just presents a page of links to each of the
controllers within that namespace). When I try to access /admin I get
a routing error (“No route matches ‘/admin’”). I thought perhaps I
could create an admin controller in the root but then I don’t see how
that wouldn’t get confused with the namespace.
The only other two lines in my routes.rb file are the default ones:
How can I create a default within the admin namespace? I’m new to
routes but from what I’ve read I’m slightly confused as to how to do
Any help is greatly appreciated.