Comments are dependents of messages, so need to destroy the latter to get the former

This commit is contained in:
David Heinemeier Hansson
2025-04-12 10:59:59 +02:00
parent 60a0360203
commit 24b02c42fd
+2 -1
View File
@@ -19,13 +19,14 @@ class Cards::CommentsController < ApplicationController
end
def destroy
@comment.destroy
@message.destroy
redirect_to @card
end
private
def set_comment
@comment = @card.comments.find(params[:id])
@message = @comment.message
end
def ensure_creatorship