13
我在学习Rails的简单测试应用程序上收到以下错误。语法错误,意外的' n',期待tCOLON2或'['或'。'
syntax error, unexpected '\n', expecting tCOLON2 or '[' or '.'
看来,它告诉是有一个undexpected休息,但我想不出有什么不对我下面的代码:
#app/views/quotations/index.html.erb
<% title "Quotations" %>
<table>
<tr>
<th>Quote Text</th>
<th>Author</th>
<th>Quote type</th>
<th>Category</th>
<th>Tags</th>
</tr>
<% for @quotations.each do |quotation| %>
<tr>
<td><%= quotation.quote_text %></td>
<td><%= quotation.author %></td>
<td><%= quotation.quote_type %></td>
<td><%= quotation.category %></td>
<td><%= quotation.tags %></td>
<td><%= link_to "Show", [@user, quotation] %></td>
<td><%= link_to "Edit", edit_user_quotation_path(@user, quotation) %></td>
<td><%= link_to "Destroy", [@user, quotation], :confirm => 'Are you sure?', :method => :delete %></td>
</tr>
<% end %>
</table>
<p><%= link_to "New Quotation", new_user_quotation_path(@user) %></p>
我已经广泛地用Google搜索这一点,并能弄清楚我的代码有什么问题。谢谢!
如果您是Ruby的新手,这是一个常见的错误。我也有这个问题.. –