【问题标题】:Restricting which MIME types a template will render in Rails限制模板将在 Rails 中呈现的 MIME 类型
【发布时间】:2013-01-19 18:47:22
【问题描述】:

给定:

  • 带有bar 操作的FooController
  • custom 扩展的 ActionView 模板处理程序
  • app/views/foo/bar.custom 的模板

有没有办法让 Rails 只为 HTML 请求呈现该模板而不将模板重命名为 bar.html.custom

【问题讨论】:

    标签: ruby-on-rails actionview


    【解决方案1】:

    我想出了如何使用自定义ActionView::Responder 来做到这一点。请参阅https://github.com/netzpirat/haml_coffee_assets/issues/80,详细了解为什么需要这样做以及我是如何解决的。

    【讨论】:

      猜你喜欢
      • 2011-11-18
      • 2011-05-26
      • 1970-01-01
      • 2020-06-15
      • 2016-01-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-09-10
      相关资源
      最近更新 更多