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的新手,這是一個常見的錯誤。我也有這個問題.. –