The article model has many comments, and the comment belongs to the article.
And the following is a part of the article partial.
<%= link_to article.title, article %>
<% if article.owned_by? current_user %>
<span class='actions'>
<%= link_to "Edit", edit_article_path(article) %>
<%= link_to "Delete", article, confirm: "Are you sure?", method: :delete %>
</span>
<% end %>
And the following is a part of the comment partial.
<%= comment.name %> <<%= comment.email %>> commented:
<% if @article.owned_by? current_user %>
<span class="actions">
<%= link_to 'Delete', [@article, comment],
:confirm => 'Are you sure?', :method => :delete %>
</span>
<% end %>
Can you tell why the article
is used in the article partial while the @article
is used in the comment partial? Why not @article
in the article partial?
I am sorry if my question is too easy to you, but it's really confusing to me.