# Namespaced application layout?

**URL:** <https://www.ruby-forum.com/t/namespaced-application-layout/169634>\
**Category:** Rails\
**Created:** [June 6, 2009, 1:53am UTC](https://www.ruby-forum.com/t/namespaced-application-layout/169634 "2009-06-06T01:53:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![elliottg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/b77776/32.png) [@elliottg](https://www.ruby-forum.com/u/elliottg)\
**Post date:** [June 6, 2009, 1:53am UTC](https://www.ruby-forum.com/t/namespaced-application-layout/169634/1 "2009-06-06T01:53:45Z")

</div>

I have an admin namespace in my app. I would like to have a layout  
that would work like app/layouts/application.html.erb, but instead off  
affecting the entire app it would only affect all the views inside of  
Admin::\*

How would this be done?

Thanks,  
Elliott

---

<div class="post-metadata">

**Author:** ![elliottg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/b77776/32.png) [@elliottg](https://www.ruby-forum.com/u/elliottg)\
**Post date:** [June 6, 2009, 5:03am UTC](https://www.ruby-forum.com/t/namespaced-application-layout/169634/2 "2009-06-06T05:03:16Z")

</div>

Create a basic admin controller, like this:

class Admin::BaseController \< ApplicationController  
layout :admin  
end

Then make all admin controllers inherit from it. And also create an  
layouts/admin.html.erb file 😉

- 

Maurício Linhares  
[http://alinhavado.wordpress.com/](http://alinhavado.wordpress.com/) (pt-br) |  
[http://codeshooter.wordpress.com/](http://codeshooter.wordpress.com/) (en)

---

<div class="post-metadata">

**Author:** ![elliottg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/b77776/32.png) [@elliottg](https://www.ruby-forum.com/u/elliottg)\
**Post date:** [June 7, 2009, 8:29pm UTC](https://www.ruby-forum.com/t/namespaced-application-layout/169634/3 "2009-06-07T20:29:38Z")

</div>

Thanks Maurício.

That worked nicely.

On Jun 5, 11:02 pm, Maurício Linhares [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
