<commit_before>class ExpensesController < ApplicationController

  def create
    @category = Category.find(params[:category_id])
    @new_expense = @category.expenses.build(expense_params)
    authorize @new_expense
    if @new_expense.save
      render json: @category, status: 201
    else
      render json: { error: @new_expense.errors.full_messages }, status: 422
    end
  end

  def destroy
    @expense = Expense.find(params[:id])
    @category = @expense.category
    
    @expense.destroy
    render json: @category
  end

  private

  def expense_params
    params.require(:expense).permit(:cost, :description)
  end

end
<commit_msg>add explicit status response<commit_after>class ExpensesController < ApplicationController

  def create
    @category = Category.find(params[:category_id])
    @new_expense = @category.expenses.build(expense_params)
    authorize @new_expense
    if @new_expense.save
      render json: @category, status: 201
    else
      render json: { error: @new_expense.errors.full_messages }, status: 422
    end
  end

  def destroy
    @expense = Expense.find(params[:id])
    @category = @expense.category
    authorize @expense
    @expense.destroy
    render json: @category, status: 200
  end

  private

  def expense_params
    params.require(:expense).permit(:cost, :description)
  end

end

{'fraction_non_alphanumeric': 0.09342301943198804, 'fraction_numerical': 0.011210762331838564, 'mean_word_length': 3.569965870307167, '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': '959873', 'n_tokens_mistral': 432, 'n_tokens_neox': 408, 'n_words': 97}