Matt G. wrote:
There’s a namespace routing feature in the 2.0 preview release. DHH’s
blog post about the changes in 2.0
has a short example of how to use it for admin interfaces.
I will need admin functionality in a few upcoming projects and am
running into the same questions for where it should go. I thought of
creating a separate Rails app to use on an admin subdomain, but that
seems like overkill.
I noticed in the inline documentation for the Controller generator
(script/generate controller --help) that it mentioned the ability to
“create a controller within a module,” but I couldn’t find any further
info on what a “module” was in this regard? Here’s the exact text:
script/generate controller --help
The controller generator creates stubs for a new controller and its
The generator takes a controller name and a list of views as
The controller name may be given in CamelCase or under_score and
not be suffixed with ‘Controller’. To create a controller within a
module, specify the controller name as ‘module/controller’.
The generator creates a controller class in app/controllers with
templates in app/views/controller_name, a helper class in
and a functional test suite in test/functional.
./script/generate controller CreditCard open debit credit close
Credit card controller with URLs like /credit_card/debit.
Views: app/views/credit_card/debit.rhtml [...]
./script/generate controller ‘admin/credit_card’ suspend late_fee
Credit card admin controller with URLs /admin/credit_card/suspend.
Views: app/views/admin/credit_card/debit.rhtml [...]
So is “module” just another term for the namespace approach that has
been mentioned above? Can anyone provide an example of using this?
And even though DHH’s post re: Rails 2.0 has some text that points to a
new solution, what is a viable solution for the 1.x line?