13

How can I remove the layout application.html.erb from rendering on a particular page. It is now visible on all pages in my application.

3 Answers 3

22

You can override default rendering at the controller level.

class Admin::HomeController < Admin::BaseController layout "admin" 

You can also override rendering of layouts at a controller action level:

def show render :layout => "layout_for_show_only" end 

And, if you are really desperate, you can override layouts in the view:

<%= render "print_view", :layout => "print" %> 

See the excellent rails guide on the subject: layouts and rendering in Rails

ian.

Sign up to request clarification or add additional context in comments.

2 Comments

thanks! I did this in the controller.. def show render :layout=>false end
@Themasterhimself- If you want to remove it from all the pages of the controller, you can do layout nil at the top of the controller.
6

You can simply add to the controller:

layout false, only: [:show, :edit] 

which means, that application layout won't be rendered for the show and edit pages

Comments

1

Here is an answer.

You can set: format.js {render :layout=>false}

jQuery + Ajax + Haml. js.erb files not firing

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.