Skip to content

Instantly share code, notes, and snippets.

@nicedawg
Created February 29, 2020 02:38
Show Gist options
  • Save nicedawg/3710992814a2d9328dd86dd8cd081df5 to your computer and use it in GitHub Desktop.
Save nicedawg/3710992814a2d9328dd86dd8cd081df5 to your computer and use it in GitHub Desktop.
[Beginning Rails 6] Listing 9-9. The Template in app/views/comments/_comment.html.erb
<div class="comment" id="comment-<%= comment.id %>">
<h3>
<%= comment.name %> &lt;<%= comment.email %>&gt; said:
<% if @article.owned_by? current_user %>
<span class="actions">
<%= link_to 'Delete', article_comment_path(article_id: @article, id: comment), confirm: 'Are you sure?', method: :delete, remote: true %>
</span>
<% end %>
</h3>
<%= comment.body %>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment