【问题标题】:Rails render formats hamlRails 渲染格式 haml
【发布时间】:2019-08-29 13:44:03
【问题描述】:

我有两个文件

/show.html
/show.html.haml

当我尝试渲染 haml 文件时,它不起作用。

render :show, :formats => [:html] #works
render :show, :formats => [:haml] #doesn't work, Missing template error

【问题讨论】:

  • show.html.haml 重命名为 show.haml

标签: ruby-on-rails ruby haml


【解决方案1】:

haml不是格式,是handler,格式还是html

这样做:render :show, formats: [:html], handlers: [:haml]

【讨论】:

    猜你喜欢
    • 2011-05-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-31
    相关资源
    最近更新 更多