简体   繁体   中英

Ruby on Rails: Rendering a Page without the Application Layout

In my Rails application, I'm trying to define a custom mime type that renders plain html without the site navigation or any formatting (css, etc). An answer to an older question that I read described how to do this by turning off the layouts entirely for the current request, but I want my rendered page to include nested layouts , just not the main application layout. How do I do this?

Try layout nil for no layout

layout 'name' for render your layout.

or you can use

render :layout => layout_name 

you can render any layout you wish, as in

render :layout => "special_nested_super_duper_layout"

ensure that the layout is located in app/views/layouts and you are good to go

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM