So this is my first experience with Rails, I did everything according to http://guides.rubyonrails.org/getting_started.html#generating-a-model
And now i can't destroy a commment... I tried several google search, i tried to remove the file then generate it again, nothing works... My comments_controller.rb
class CommentsController < ApplicationController
def index
end
def show
end
def new
end
def edit
end
def create
@article = Article.find(params[:article_id])
@comment = @article.comments.create(comment_params)
redirect_to article_path(@article)
end
def destroy
@article = Article.find(params[:article_id])
@comment = @article.comments.find(params[:id])
@comment.destroy!
redirect_to article_path(@article)
end
private
def comment_params
params.require(:comment).permit(:commenter, :body)
end
end
p>
<strong>Commenter:</strong>
<%= comment.commenter %>
</p>
And my _comment.html.erb is
<p>
<strong>Comment:</strong>
<%= comment.body %>
</p>
<p>
<%= link_to 'Delete the comment', [comment.article, comment],
method: :delete,
data: { confirm: 'Are you sure?' } %>
</p>
I receive this when i click on the "Delete the comment" button
Missing template comments/show, application/show with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :jbuilder]}. Searched in: * "/root/blog/app/views"
But that shouldn't be the problem since I'm doing a redirect to the article path ? Right?? I sure hope this is a typo somewhere but now I can't find it....
Edit : this is the text of the button
<form action="/articles/2/comments/1" class="button_to" method="post"> <div><input type="submit" value="Delete the comment" data="{:confirm=>"Are you sure?"}" method="delete"><input name="authenticity_token" type="hidden" value="rW+wymZlJp2cMrhGUX31Y/vLz+qZ1VHTEVHaavS7YTU="></div></form>