Rails 3 中 XML 构建器的布局
我想为 XML 响应创建通用布局文件。例如,我想将 RSS 的一般部分包装在布局中,并将内容保留在相应的视图文件中生成。
例如,
# in layout/rss.xml.builder
xml.instruct!
...... # other general stuff for RSS
yield
# in items/show.xml.builder
xml.item ......
因此项目显示视图无需担心 RSS 包装。
然而,yield 不起作用,只渲染了布局,但视图没有返回任何内容。
请帮忙。
I would like to create general layout file for XML response. For example I would like to wrap those general part of RSS in the layout and leave the content be generated in the corresponding view file.
For example,
# in layout/rss.xml.builder
xml.instruct!
...... # other general stuff for RSS
yield
# in items/show.xml.builder
xml.item ......
So the item show view no need to worry the RSS wrappings.
However the yield is not working and only the layout is rendered, but the view returned nothing.
Please help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试:
Try: