How to remove application layout from a particualar Ruby on Rails page?
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.
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.
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
Here is an answer.
You can set: format.js {render :layout=>false}
jQuery + Ajax + Haml. js.erb files not firing
精彩评论