<commit_before>require_dependency "personal_blog/application_controller"

module PersonalBlog
  class CommentsController < ApplicationController
    def create
      @post = Post.find(params[:post_id])
      @comment = @post.comments.create(comment_params)
      flash[:notice] = "Comment has been created!"
      redirect_to posts_path
    end

    private
    def comment_params
      params.require(:comment).permit(:text)
    end
  end
end<commit_msg>Redirect to same post after commenting on it<commit_after>require_dependency "personal_blog/application_controller"

module PersonalBlog
  class CommentsController < ApplicationController
    def create
      @post = Post.find(params[:post_id])
      @comment = @post.comments.create(comment_params)
      flash[:notice] = "Comment has been created!"
      redirect_to post_path(@post)
    end

    private
    def comment_params
      params.require(:comment).permit(:text)
    end
  end
end
{'fraction_non_alphanumeric': 0.08130939809926083, 'fraction_numerical': 0.0, 'mean_word_length': 3.88659793814433, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6535677', 'n_tokens_mistral': 262, 'n_tokens_neox': 254, 'n_words': 62}