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
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.
2 Comments
Themasterhimself
thanks! I did this in the controller.. def show render :layout=>false end
rubyprince
@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.Here is an answer.
You can set: format.js {render :layout=>false}