# Scaffolding with namespace

**URL:** <https://www.ruby-forum.com/t/scaffolding-with-namespace/136623>\
**Category:** Rails\
**Created:** [May 4, 2008, 5:28pm UTC](https://www.ruby-forum.com/t/scaffolding-with-namespace/136623 "2008-05-04T17:28:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![html-kurs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/ea5d25/32.png) [@html-kurs](https://www.ruby-forum.com/u/html-kurs)\
**Post date:** [May 4, 2008, 5:28pm UTC](https://www.ruby-forum.com/t/scaffolding-with-namespace/136623/1 "2008-05-04T17:28:43Z")

</div>

Hi,

is there a way to scaffold with namespace?  
I’d like to generate a Posts model with namespace admin. But using  
script/generate scaffold admin/post title:string  
the migration would generate a table “admin\_posts”.  
So I did now  
script/generate scaffold post title:string  
moved the controller, views manually to admin/… and had to change each  
link manually from (e.g.)  
redirect\_to @post  
to  
redirect\_to(admin\_post\_path(@post))

I think there has to be a simpler way.

Tia,  
Martin

---

<div class="post-metadata">

**Author:** ![html-kurs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/ea5d25/32.png) [@html-kurs](https://www.ruby-forum.com/u/html-kurs)\
**Post date:** [May 4, 2008, 8:35pm UTC](https://www.ruby-forum.com/t/scaffolding-with-namespace/136623/2 "2008-05-04T20:35:48Z")

</div>

Martin wrote:

> is there a way to scaffold with namespace?

Don’t lean on scaffolds too much. Rails coding is generally not about  
the  
scaffolds.

> So I did now  
> script/generate scaffold post title:string  
> moved the controller, views manually to admin/… and had to change each  
> link manually from (e.g.)  
> redirect\_to @post  
> to  
> redirect\_to(admin\_post\_path(@post))

A generator produced rubber-stamp code for you to upgrade. The rest is  
up to  
you.

Next, scaffolds are fun for people who understand databases, which means  
they might not be the best solution for your customers. They might need  
pages which lead them thru their workflow, regardless which models these  
cross.

–  
Phlip
