views:

19

answers:

1

My app/views/layouts folder looks like this:

application.html.erb
user_sessions.html.erb
errors.html.erb

These work fine and i have no problems with them but id now like to add a new layout for tips, but only on the index and show actions.

Would "tips.index.html.erb" work?

+1  A: 

Add a new layout as you like called 'tips.html.erb'

In the tips controller add the following:

layout "tips", :only => [ :index, :show ]

You can specify the layout for a specific action using:

def new 
    render(:layout => "layouts/application")
end

I have never tried using multiple layout declarations in a controller. It might be that adding another

layout "standard", :only => [ :new, :edit ] 

might work...

dtt101
using the new/edit use no layout file.
Arcath
I have updated my answer - hope that works!
dtt101