<commit_before>class AnswersController < ApplicationController
  before_action :set_answer, only: [:show, :edit, :update, :destroy]

  def index
    @answers = Answer.all
  end

  def show
  end

  def new
    @answer = Answer.new()
  end

  def create
    @answer = Answer.new(answer_params)
    if @answer.save
      redirect_to @answer
      render :show
    else
      render :new
    end
  end

  def edit
  end

  def update
    if @answer.update(answer_params)
      redirect_to @answer
      render :show
    else
      render :edit
    end
  end

  def destroy
  private

  def set_answer
    @answer = Answer.find(params[:id])
  end

  def answer_params
    params.require(:answer).permit(:content, :question_id, :user_id)
  end<commit_msg>add destroy method to answers controller<commit_after>class AnswersController < ApplicationController
  before_action :set_answer, only: [:show, :edit, :update, :destroy]

  def index
    @answers = Answer.all
  end

  def show
  end

  def new
    @answer = Answer.new()
  end

  def create
    @answer = Answer.new(answer_params)
    if @answer.save
      redirect_to @answer
      render :show
    else
      render :new
    end
  end

  def edit
  end

  def update
    if @answer.update(answer_params)
      redirect_to @answer
      render :show
    else
      render :edit
    end
  end

  def destroy
    @answer.destroy
    redirect_to answers_url
  end

  private

  def set_answer
    @answer = Answer.find(params[:id])
  end

  def answer_params
    params.require(:answer).permit(:content, :question_id, :user_id)
  end
{'fraction_non_alphanumeric': 0.07838179519595449, 'fraction_numerical': 0.0, 'mean_word_length': 2.6307339449541285, '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': '5433878', 'n_tokens_mistral': 524, 'n_tokens_neox': 500, 'n_words': 144}