# Layout

**URL:** <https://www.ruby-forum.com/t/layout/167106>\
**Category:** Rails\
**Created:** [May 4, 2009, 3:40am UTC](https://www.ruby-forum.com/t/layout/167106 "2009-05-04T03:40:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bartolome](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bcef8e/32.png) [@bartolome](https://www.ruby-forum.com/u/bartolome)\
**Post date:** [May 4, 2009, 3:40am UTC](https://www.ruby-forum.com/t/layout/167106/1 "2009-05-04T03:40:33Z")

</div>

I’ve been having a problem. I have an application layout and a users  
controller. All the methods, but forgot\_password, must use the  
application  
layout. So, I added below the class declaration the following line:

class UsersController \< ApplicationController  
layout ‘login’, :only =\> [:forgot\_password]

The problem is: if I write down that layout line, all methods but  
forgot\_password will have no layout. I cannot use render :layout =\>  
‘forgot\_password’ into the forgot\_password method because it already has  
a  
render call. I tried the following code it also didn’t work.

class UsersController \< ApplicationController  
layout ‘login’, :only =\> [:forgot\_password]  
layout ‘application’, :except =\> [:forgot\_password]

Does anybody have any suggestion to apply the login layout to the  
forgot\_password method and the application to the other ones? Thanks in  
advance.

–  
_Rodrigo F._  
Web D.  
SCJP

---

<div class="post-metadata">

**Author:** ![bartolome](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bcef8e/32.png) [@bartolome](https://www.ruby-forum.com/u/bartolome)\
**Post date:** [May 4, 2009, 12:44pm UTC](https://www.ruby-forum.com/t/layout/167106/2 "2009-05-04T12:44:28Z")

</div>

I think you need to move the layout statement into  
the :forgot\_password method. all the other methods will then use  
application

On May 3, 9:39 pm, Rodrigo F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
