<commit_before>class PledgesController < ApplicationController
  before_action :authenticate_user
  before_action :authenticate_admin :except => [:index]

  def index
    @pledges = Pledge.all
  end

  def new
    @pledge = Pledge.new
  end

  def create
    @pledge = Pledge.new create_params

    if @pledge.save
      flash[:success] = "Pledge was successfully created."
      render :index 
    else
      flash[:error] = "Pledge was not able to be created."
      render :new
    end
  end

  def edit
    @pledge = Pledge.find params[:id]
  end

  def update
    @pledge = Pledge.find params[:id]

    if @pledge.update_attributes update_params
      flash[:success] = "Pledge updated."
      render :index
    else 
      flash[:error] = "Pledge could not be updated."
      render :edit
    end
  end

  def destroy
    @pledge = Pledge.find params[:id]

    if @pledge.destroy
      flash[:success] = "Pledge deleted."
      render :index
    else 
      flash[:error] = "Pledge was not able to be deleted."
      render :index
    end 
  end
end<commit_msg>Added create_params to pledges controller<commit_after>class PledgesController < ApplicationController
  before_action :authenticate_user
  before_action :authenticate_admin :except => [:index]

  def index
    @pledges = Pledge.all
  end

  def new
    @pledge = Pledge.new
  end

  def create
    @pledge = Pledge.new create_params

    if @pledge.save
      flash[:success] = "Pledge was successfully created."
      render :index 
    else
      flash[:error] = "Pledge was not able to be created."
      render :new
    end
  end

  def edit
    @pledge = Pledge.find params[:id]
  end

  def update
    @pledge = Pledge.find params[:id]

    if @pledge.update_attributes update_params
      flash[:success] = "Pledge updated."
      render :index
    else 
      flash[:error] = "Pledge could not be updated."
      render :edit
    end
  end

  def destroy
    @pledge = Pledge.find params[:id]

    if @pledge.destroy
      flash[:success] = "Pledge deleted."
      render :index
    else 
      flash[:error] = "Pledge was not able to be deleted."
      render :index
    end 
  end

  private 
  def create_params
    params.require(:sponsor).permit(:level, :pledge_type, :amount_pledged, :amount_paid, :inkind_pledged, :inkind_received)
  end
  
  def update_params
    create_params 
  end
end
{'fraction_non_alphanumeric': 0.08600337268128162, 'fraction_numerical': 0.0, 'mean_word_length': 2.6451612903225805, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '958425', 'n_tokens_mistral': 767, 'n_tokens_neox': 731, 'n_words': 221}