This shows all the comments but it also shows an extra edit and delete button at the end. But when I reverse the order that is, I show Add comment after all the comments this bug seems to disappear. Anyone can point out what is happening? Also, I would like suggestions for better coding standards.
<div class="alert alert-success">
<h3>Add Comment</h3>
<%= form_for([@article, @article.comments.build]) do |f| %>
<%= f.text_field :name, size:80 %>
<%= f.submit "Comment", class: "btn btn-primary" %>
<% end %>
</div>
<h3>Comments</h3>
<% @article.comments.each do |comment| %>
<div class="alert alert-info">
<h4><%= comment.name %></h4>
<table>
<tr>
<td><%= link_to 'Edit', [comment.article, comment], method: :put, class: "btn btn-primary" %></td>
<td><%= button_to 'Delete', [comment.article, comment], method: :delete, class: "btn btn-danger" %></td>
</tr>
</table>
</div>
<% end %>