Skip to content

Commit

Permalink
Fix destroy redirect path for comments
Browse files Browse the repository at this point in the history
Should redirect back to the idea page, not a generic comments index
path.
  • Loading branch information
tombruijn committed May 20, 2023
1 parent 616d83a commit 45f54b8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions _pages/commenting.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Open the file you just created in your Text Editor, it should be empty, and copy

{% highlight ruby %}
class CommentsController < ApplicationController
before_action :set_idea, only: %i[create]
before_action :set_idea, only: %i[create destroy]
before_action :set_comment, only: %i[destroy]

def create
Expand All @@ -124,7 +124,7 @@ class CommentsController < ApplicationController
def destroy
@comment.destroy

redirect_to comments_url, notice: "Comment was successfully destroyed."
redirect_to idea_path(@idea), notice: "Comment was successfully destroyed."
end

private
Expand Down

0 comments on commit 45f54b8

Please sign in to comment.