Rails layouts per action?

Posted by mrbrdo on Stack Overflow See other posts from Stack Overflow or by mrbrdo
Published on 2010-06-11T19:53:33Z Indexed on 2010/06/11 20:02 UTC
Read the original article Hit count: 135

Filed under:

I use a different layout for some actions (mostly for the new action in most of the controllers). I am wondering what the best way to specify the layout would be? (Consider like I am using 3 or more different layouts in the same controller)

I don't like using

render :layout => 'name'

that much. I did like doing

layout 'name', :only => [:new]

but it turns out I can't use that to specify 2 different layouts (e.g. if I call layout 2 times in the same controller, with different layout names and different only options, the first one gets ignored - those actions don't display in the layout i specified). I'm using Rails 2.

© Stack Overflow or respective owner

Related posts about ruby-on-rails