我在Rails 3.2應用程序中使用haml_coffee_assets。以下作品在ejs模板中:Haml Coffee Assets Template錯誤,無法訪問Backbone JS模型?
<table>
<tr>
<th></th>
</tr>
<% tutorials.each(function(model) { %>
<tr>
<td><%= model.escape('title') %>
</tr>
<% }); %>
</table>
我似乎無法在haml_coffee中使用此工作。以下是我最好的猜測,但由於某種原因,這個haml_coffee模板不起作用:
%table
%thead
%tr
%th Tutorial Name
%tbody
- for tutorial in @tutorials
- do (model) ->
%tr
%td= model.title
所有我這個得到的是:
ReferenceError: Can't find variable: model
是的,謝謝。我將更新問題以包含Backbone JS。這很棒。 – Dylan