<commit_before>class AlternateNamesController < ApplicationController
  before_action :authenticate_member!, except: [:index, :show]
  load_and_authorize_resource
  respond_to :html, :json

  # GET /alternate_names
  # GET /alternate_names.json
  def index
    @alternate_names = AlternateName.all
    respond_with(@alternate_names)
  end

  # GET /alternate_names/new
  # GET /alternate_names/new.json
  def new
    @alternate_name = AlternateName.new
    @crop = Crop.find_or_initialize_by(id: params[:crop_id])
  end

  # GET /alternate_names/1/edit
  def edit; end

  # POST /alternate_names
  # POST /alternate_names.json
  def create
    params[:alternate_name][:creator_id] = current_member.id
    @alternate_name = AlternateName.new(alternate_name_params)

    if @alternate_name.save
      redirect_to @alternate_name.crop, notice: 'Alternate name was successfully created.'
    else
      render action: "new"
    end
  end

  # PUT /alternate_names/1
  # PUT /alternate_names/1.json
  def update
    if @alternate_name.update(alternate_name_params)
      redirect_to @alternate_name.crop, notice: 'Alternate name was successfully updated.'
    else
      render action: "edit"
    end
  end

  # DELETE /alternate_names/1
  # DELETE /alternate_names/1.json
  def destroy
    @crop = @alternate_name.crop
    @alternate_name.destroy
    redirect_to @crop, notice: 'Alternate name was successfully deleted.'
  end

  private

  def alternate_name_params
    params.require(:alternate_name).permit(:crop_id, :name, :creator_id)
  end
end
<commit_msg>Add responders to alternate names controller<commit_after>class AlternateNamesController < ApplicationController
  before_action :authenticate_member!, except: [:index, :show]
  load_and_authorize_resource
  respond_to :html, :json
  responders :flash

  # GET /alternate_names
  # GET /alternate_names.json
  def index
    @alternate_names = AlternateName.all
    respond_with(@alternate_names)
  end

  # GET /alternate_names/new
  # GET /alternate_names/new.json
  def new
    @alternate_name = AlternateName.new
    @crop = Crop.find_or_initialize_by(id: params[:crop_id])
  end

  # GET /alternate_names/1/edit
  def edit; end

  # POST /alternate_names
  # POST /alternate_names.json
  def create
    params[:alternate_name][:creator_id] = current_member.id
    @alternate_name = AlternateName.new(alternate_name_params)

    if @alternate_name.save
      redirect_to @alternate_name.crop, notice: 'Alternate name was successfully created.'
    else
      render action: "new"
    end
  end

  # PUT /alternate_names/1
  # PUT /alternate_names/1.json
  def update
    if @alternate_name.update(alternate_name_params)
      redirect_to @alternate_name.crop, notice: 'Alternate name was successfully updated.'
    else
      render action: "edit"
    end
  end

  # DELETE /alternate_names/1
  # DELETE /alternate_names/1.json
  def destroy
    @crop = @alternate_name.crop
    @alternate_name.destroy
    redirect_to @crop, notice: 'Alternate name was successfully deleted.'
  end

  private

  def alternate_name_params
    params.require(:alternate_name).permit(:crop_id, :name, :creator_id)
  end
end

{'fraction_non_alphanumeric': 0.08430691506157247, 'fraction_numerical': 0.0031575623618566467, 'mean_word_length': 3.814589665653495, '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': '3097533', 'n_tokens_mistral': 1089, 'n_tokens_neox': 1055, 'n_words': 233}