# How to use layout with LoginEngine (or UserEngine) views?

**URL:** <https://www.ruby-forum.com/t/how-to-use-layout-with-loginengine-or-userengine-views/53219>\
**Category:** Engines\
**Created:** [January 29, 2006, 5:45pm UTC](https://www.ruby-forum.com/t/how-to-use-layout-with-loginengine-or-userengine-views/53219 "2006-01-29T17:45:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![lopmx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/258eb7/32.png) [@lopmx](https://www.ruby-forum.com/u/lopmx)\
**Post date:** [January 29, 2006, 5:45pm UTC](https://www.ruby-forum.com/t/how-to-use-layout-with-loginengine-or-userengine-views/53219/1 "2006-01-29T17:45:53Z")

</div>

Hi

How to use layout with LoginEngine (or UserEngine) views without  
overwriting the engine files?

Peter

---

<div class="post-metadata">

**Author:** ![lopmx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/258eb7/32.png) [@lopmx](https://www.ruby-forum.com/u/lopmx)\
**Post date:** [January 29, 2006, 9:53pm UTC](https://www.ruby-forum.com/t/how-to-use-layout-with-loginengine-or-userengine-views/53219/2 "2006-01-29T21:53:57Z")

</div>

Or alternatively, use the code-mixing feature. Create your own layout  
in /app/views/layouts/whatever.rhtml, and then if you want it to be  
used everywhere, set it in your /app/controllers/application.rb file.  
If you want to be able to use your custom layout on only specific  
controllers from within an engine, just create the correctly-named  
controller in your /app/controllers directory, i.e.

/app/controllers/user\_controller.rb

class UserController \< ApplicationController  
layout :whatever  
end

… it should be that easy.

- james

---

<div class="post-metadata">

**Author:** ![lopmx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/258eb7/32.png) [@lopmx](https://www.ruby-forum.com/u/lopmx)\
**Post date:** [January 29, 2006, 10:18pm UTC](https://www.ruby-forum.com/t/how-to-use-layout-with-loginengine-or-userengine-views/53219/3 "2006-01-29T22:18:08Z")

</div>

So i just create a normal ‘copy’ of a Engine controller? I’d like to use  
a special template for login action in UserController, so i just setup  
an empty UserController and force the action to use a different view?  
(using layout method)

---

<div class="post-metadata">

**Author:** ![lopmx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/258eb7/32.png) [@lopmx](https://www.ruby-forum.com/u/lopmx)\
**Post date:** [January 29, 2006, 9:47pm UTC](https://www.ruby-forum.com/t/how-to-use-layout-with-loginengine-or-userengine-views/53219/4 "2006-01-29T21:47:53Z")

</div>

Create a layout in app/views/layouts/application.rhtml which will wrap  
around the default views for each of the engines.

-Nb

```auto
 Nathaniel S. H. Brown http://nshb.net

```

> How to use layout with LoginEngine (or UserEngine) views  
> without overwriting the engine files?
> 
> Peter
> 
> * * *
> 
> engine-users mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rails-engines.org/listinfo.cgi/engine-users-rails](http://lists.rails-engines.org/listinfo.cgi/engine-users-rails)  
> -engines.org

---

<div class="post-metadata">

**Author:** ![lopmx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/258eb7/32.png) [@lopmx](https://www.ruby-forum.com/u/lopmx)\
**Post date:** [January 30, 2006, 12:42pm UTC](https://www.ruby-forum.com/t/how-to-use-layout-with-loginengine-or-userengine-views/53219/5 "2006-01-30T12:42:46Z")

</div>

James A. wrote:

- James, Great, just what I needed to know as well…

Do you have a Wiki (or something) where these snips are documented, I  
(and I’m sure others) would be happy to help.

- Jonathan

> Or alternatively, use the code-mixing feature. Create your own layout  
> in /app/views/layouts/whatever.rhtml, and then if you want it to be  
> used everywhere, set it in your /app/controllers/application.rb file.  
> If you want to be able to use your custom layout on only specific  
> controllers from within an engine, just create the correctly-named  
> controller in your /app/controllers directory, i.e.
> 
> /app/controllers/user\_controller.rb
> 
> class UserController \< ApplicationController  
> layout :whatever  
> end
> 
> … it should be that easy.
> 
> - james

---

<div class="post-metadata">

**Author:** ![lopmx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/258eb7/32.png) [@lopmx](https://www.ruby-forum.com/u/lopmx)\
**Post date:** [January 30, 2006, 12:47pm UTC](https://www.ruby-forum.com/t/how-to-use-layout-with-loginengine-or-userengine-views/53219/6 "2006-01-30T12:47:54Z")

</div>

The rails engines site (which is a wiki) should be your first port of  
call:

[http://rails-engines.org](http://rails-engines.org)

If you feel any documentation is lacking, please do insert some there.  
The primary source of documentation for engines lies within the  
engines themselves in the form of rdoc (which you can generate using  
rake engine\_doc), and is also available at  
[http://api.rails-engines.org/](http://api.rails-engines.org/)

- james

---

<div class="post-metadata">

**Author:** ![lopmx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/258eb7/32.png) [@lopmx](https://www.ruby-forum.com/u/lopmx)\
**Post date:** [January 29, 2006, 10:21pm UTC](https://www.ruby-forum.com/t/how-to-use-layout-with-loginengine-or-userengine-views/53219/7 "2006-01-29T22:21:09Z")

</div>

Yup. Have a look at the engines documentation for more info…
