<commit_before>class ImprovementsController < ApplicationController
  protect_from_forgery
  
  def create
    @solution = Solution.find params[:solution_id]
    @improvement = Improvement.new(improvement_params)
    respond_to do |format|
      if @improvement.save
        # format.html { redirect_to @improvement, notice: "Improvement was successfully created." }
        # format.js {}
        format.json { render json: @improvement, status: :created}
      else
        # format.html {}
        format.json { render json: @improvement.errors, status: :unprocessable_entity }
      end
    end
  end

  private

  def improvement_params
    params.require(:improvement).permit(:title, :description)
  end
end<commit_msg>create new improvement<commit_after>class ImprovementsController < ApplicationController
  protect_from_forgery

  def create
    @solution = Solution.find params[:solution_id]

     @improvement = Improvement.new(title: params[:title], description: params[:description], solution_id: params[:solution_id], user_id: current_user.id, problem_id: @solution.problem.id )
    respond_to do |format|
      if @improvement.save
      format.js {render nothing: true}
        # format.html { redirect_to @improvement, notice: "Improvement was successfully created." }
        # format.js {}
        # format.json { render json: @improvement, status: :created}
      # else
      #   format.html {}
      #   format.json { render json: @improvement.errors, status: :unprocessable_entity }
      end
    end
  end

  private

  def improvement_params
    params.require(:improvement).permit(:title, :description, :solution_id)
  end
end
{'fraction_non_alphanumeric': 0.09624697336561744, 'fraction_numerical': 0.0, 'mean_word_length': 3.5040871934604905, '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': '3508468', 'n_tokens_mistral': 489, 'n_tokens_neox': 457, 'n_words': 113}