Ruby on Rails - 如何在没有应用程序布局的情况下呈现动作?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3840926/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Ruby on Rails - How do I render an action without the application layout?
提问by Dean
I have a rails app and I want to render an action without using my application layout (which has page header / footer stuff in it).
我有一个 rails 应用程序,我想在不使用我的应用程序布局(其中包含页眉/页脚内容)的情况下呈现一个动作。
How could I go about doing this?
我怎么能去做这件事?
回答by marcgg
Here's some documentation about it: http://guides.rubyonrails.org/layouts_and_rendering.html
这里有一些关于它的文档:http: //guides.rubyonrails.org/layouts_and_rendering.html
For your question:
对于您的问题:
render :layout => false
or
或者
layout false
回答by stevec
For Rails 5, in the controller, for the specific action:
对于 Rails 5,在控制器中,对于具体操作:
def action
render layout: false
end

