【发布时间】:2013-01-19 18:47:22
【问题描述】:
给定:
- 带有
bar操作的FooController -
custom扩展的 ActionView 模板处理程序 -
app/views/foo/bar.custom的模板
有没有办法让 Rails 只为 HTML 请求呈现该模板而不将模板重命名为 bar.html.custom?
【问题讨论】:
给定:
bar 操作的FooController
custom 扩展的 ActionView 模板处理程序app/views/foo/bar.custom 的模板
有没有办法让 Rails 只为 HTML 请求呈现该模板而不将模板重命名为 bar.html.custom?
【问题讨论】:
我想出了如何使用自定义ActionView::Responder 来做到这一点。请参阅https://github.com/netzpirat/haml_coffee_assets/issues/80,详细了解为什么需要这样做以及我是如何解决的。
【讨论】: