I'm getting the following error on a simple test app I am working on to learns Rails.
syntax error, unexpected '\n', expecting tCOLON2 or '[' or '.'
It appears that it's telling be that there is an undexpected break, but I can't figure out what is wrong with my code below:
#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>
I've googled this extensively and can't figure out what's wrong with my code. Thanks!
One thing I noticed is it looks like you're mixing methodologies for looping over collections in ruby. That should work if you remove the for
in the line <% for @quotations.each do |quotation| %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With