<commit_before>module ErCrm
  class DepartmentsController < ApplicationController
    def index
      @departments = Department.all

      respond_to do |format|
        format.html
      end
    end

    def new
      @department = Department.new

      respond_to do |format|
        format.html
      end
    end

    def create
      @department = Department.new(permitted_params)

      begin
        @department.save!
        redirect_to departments_path
      rescue ActiveRecord::RecordInvalid => e
        render :action => :new
      end
    end

    def show
      @department = Department.find(params[:id])

      respond_to do |format|
        format.html
      end
    end

    def edit
      @department = Department.find(params[:id])

      respond_to do |format|
        format.html
      end
    end

    def update
      @department = Department.find(params[:id])
      @department.attributes = permitted_params

      begin
        @department.save!
        redirect_to department_path(@department)
      rescue ActiveRecord::RecordInvalid => e
        render :action => :edit
      end
    end

    def destroy
      @department = Department.find(params[:id])
      @department.destroy

      redirect_to departments_path
    end

    def permitted_params
      params.require(:department).permit(:id, :name)
    end
  end
end<commit_msg>departments fixes<commit_after>module ErCrm
  class DepartmentsController < ApplicationController
    def index
      @departments = Department.all

      respond_to do |format|
        format.html
      end
    end

    def new
      @department = Department.new

      respond_to do |format|
        format.html
      end
    end

    def create
      @department = Department.new(permitted_params)

      begin
        @department.save!
        redirect_to departments_path
      rescue ActiveRecord::RecordInvalid => e
        render :action => :new
      end
    end

    def show
      @department = Department.find(params[:id])

      respond_to do |format|
        format.html
      end
    end

    def edit
      @department = Department.find(params[:id])

      respond_to do |format|
        format.html
      end
    end

    def update
      @department = Department.find(params[:id])
      @department.attributes = permitted_params

      begin
        @department.save!
        redirect_to department_path(@department)
      rescue ActiveRecord::RecordInvalid => e
        render :action => :edit
      end
    end

    def destroy
      @department = Department.find(params[:id])
      @department.destroy

      redirect_to departments_path
    end

    private
    def permitted_params
      params.require(:department).permit(:id, :name)
    end
  end
end
{'fraction_non_alphanumeric': 0.07242136064374542, 'fraction_numerical': 0.0, 'mean_word_length': 2.118586088939567, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '6098411', 'n_tokens_mistral': 800, 'n_tokens_neox': 745, 'n_words': 189}