{ :feed_item => feed-6ren">
gpt4 book ai didi

ruby-on-rails - 如何在没有布局的帮助器中呈现 View /部分?

转载 作者:行者123 更新时间:2023-12-04 06:23:15 27 4
gpt4 key购买 nike

你好, helper 我正在做以下事情:

render(:template =>"feeds/_feed_item.html.erb", :locals => { :feed_item => feed_item }).to_s

问题是这是渲染我不想要的布局。如何仅呈现文件/模板 feed_item ?

谢谢

最佳答案

您可以添加选项 :layout => false在没有布局的情况下进行渲染。

例子:

render(:template =>"feeds/_feed_item.html.erb", :layout => nil , :locals => { :feed_item => feed_item }).to_s

关于ruby-on-rails - 如何在没有布局的帮助器中呈现 View /部分?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6319321/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com