Reputation: 21
<h1>All Articles</h1>
<ul>
<% @articles.each.do |article| %>
<li>
<%= article.title %>
</li>
<% end %>
</ul>
I keep getting "syntax error, unexpected keyword_ensure, expecting $end" I am totally confused on whats going on.
Upvotes: 2
Views: 41
Reputation: 16084
do
is not a method of each: it's a signifier for the beginning of a block. You want this:
<h1>All Articles</h1>
<ul>
<% @articles.each do |article| %>
<li>
<%= article.title %>
</li>
<% end %>
</ul>
Upvotes: 1