Skip to content

Commit

Permalink
[#11] Fixed issue with comment helper method.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmckissock committed Jul 1, 2024
1 parent c0d06d8 commit e7499bc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 5 additions & 0 deletions app/controllers/comments_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
class CommentsController < ApplicationController
before_action :authorized, only: [:create]
helper_method :comment

def show
@reply = Comment.new
Expand Down Expand Up @@ -41,6 +42,10 @@ def article
@article ||= Article.find(params[:article_id])
end

def comment
@comment ||= Comment.find(params[:id])
end

def comment_params
params.require(:comment).permit(:text, :parent_id)
end
Expand Down
3 changes: 0 additions & 3 deletions app/helpers/comments_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,4 @@ def render_comment_tree(comment)
end
end

def comment
@comment ||= Comment.find(params[:id])
end
end

0 comments on commit e7499bc

Please sign in to comment.