back /front page question


Imaging I want to use another layout for show and one for edit and new.

Must I then make two different application layouts with 2 css files or can I do that with 1 layout file and 1 css file ?


hello, individual actions can render specific layouts.

def show   render(layout: "layouts/show") end

def edit   render(layout: "layouts/edit") end

def new   render(layout: "layouts/new") end

but i dont know how to avoid double rendering

Just create admin.html.erb like application.html.erb under views/layouts/


Just mentions in your controller which ever controller you need to use admin layout

class TestController < InheritedResources::Base

layout "admin"


Or you can give a parameter from new.html.erb or edit.html.erb to _form.html.erb.

In the _form.html.erb,check the parameter where it from and do the different things.

在 2012年10月11日星期四UTC+9上午3时29分40秒,roelof写道:

Thanks for all the answers and solutions.

Now see what will work for me.