jua*_*tas 2 ruby-on-rails coffeescript slim-lang
这就是我所做的,在开发中工作,在生产中失败。
javascript:
#{ raw render 'my_partial.js' }
Run Code Online (Sandbox Code Playgroud)
我的部分叫做my_partial.js.coffee.
这也适用于开发:
javascript:
#{ raw render 'my_partial.js', handlers: [:coffee]}
Run Code Online (Sandbox Code Playgroud)
还有其他方法吗,比如:
coffee:
#{ render 'my_partial' }
Run Code Online (Sandbox Code Playgroud)
我的意思是,在纤薄的模板中包含咖啡部分的最短形式是什么?以及为什么第一种方法在生产中失败,说:
ActionView::Template::Error (Missing partial my_partial
with {:locale=>[:en], :formats=>[:js], :handlers=>[:erb, :builder, :slim]}
Run Code Online (Sandbox Code Playgroud)
您根本不应该使用任何过滤器。
你的苗条文件应该只使用
= render 'my_partial'
Run Code Online (Sandbox Code Playgroud)
你的部分应该包含
coffee:
# coffee script here
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2802 次 |
| 最近记录: |