Naming controllers in modules?

Hey guys.

I noticed in an example from the active scaffold documentation that it
seems to be possible to put rails controllers in modules, a la “class
Admin::CompaniesController < ApplicationController”. Does anyone know
anything about this? What do you name the file? Do you put it in a



Just: script/generate model controlelr admin::companies
And that is was!

It will create a controller named CompanyController in a subdir named
admin. From the ruby point of view, CompanyController belongs to admin
namespace (class Admin::CompanyController)


Funny, I just started using this and wanted to understand exactly that.

I can’t test it in my app right now, but I’d venture a guess that it
would map to: admin/company/

Here’s a question… I notice you’re running the model generator as
well. Does that mean I would not be able to “share” a Company model
between two different controller namespaces, say
Admin::CompanyController and Guest::CompanyController?

Best regards,

Mauricio L. Sadicoff
[email protected]

“Peace of mind isn’t at all superficial, really,” I expound. “It’s
the whole thing. That which produces it is good maintenance; that
which disturbs it is poor maintenance. What we call workability of
the machine is just an objectification of this peace of mind. The
ultimate test is always your own serenity.” - Zen and the Art of
Motorcycle Maintenance.

thanks, thats very helpful. one more question: what address does this
get mapped to? …/admin/companies doesn’t seem to work…?

On May 30, 6:54 am, Jean-Etienne D. <rails-mailing-l…@andreas-