Can generate scaffold put the controller in a namespace?

pupeno picture pupeno · Jun 15, 2010 · Viewed 13.6k times · Source

I want to generate the scaffold in a Rails app, generating the model as usual but having the controller inside the admin namespace. Is it possible?

Answer

pupeno picture pupeno · Jun 15, 2010

The first time I've done it, I run

script/generate scaffold blog

and then refactored the controller, views, etc. My prefered solution at the moment is:

script/generate scaffold admin::blog

and then refactor the model, unit test and migration; it's less work.

If there's a better answer, I'll accept it.