<commit_before>module Tenant
  class EmployeesController < AdminController
  
    def index
      @employees = current_account.employees.page(params[:page])
    end
    
    def new
      @employee = Employee.new

      respond_to do |format|
        format.html # new.html.erb
      end
    end
    
    def create
      @employee = current_account.employees.build(params[:employee])

      respond_to do |format|
        if @employee.save
          format.html { redirect_to(employees_url, :notice => 'Employee was successfully created.') }
        else
          format.html { render :action => "new" }
        end
      end
    end
    
    def edit
      @employee = current_account.employees.find_by_identifier(params[:id])
    end
    
    def update
      @employee = current_account.employees.find_by_identifier(params[:id])

      respond_to do |format|
        if @employee.update_attributes(params[:employee])
          format.html { redirect_to(employees_url, :notice => 'Employee was successfully updated.') }
        else
          format.html { render :action => "edit" }
        end
      end
    end
    
    def destroy
      @employee = current_account.employees.find_by_identifier(params[:id])
      @employee.destroy
    
      respond_to do |format|
        format.html { redirect_to(employees_url, :notice => 'Employee was successfully deleted.') }
        format.js   {}
      end
    end
  
  end
end<commit_msg>corrected employee update action to allow for blank passwords<commit_after>module Tenant
  class EmployeesController < AdminController
  
    def index
      @employees = current_account.employees.page(params[:page])
    end
    
    def new
      @employee = Employee.new

      respond_to do |format|
        format.html # new.html.erb
      end
    end
    
    def create
      @employee = current_account.employees.build(params[:employee])

      respond_to do |format|
        if @employee.save
          format.html { redirect_to(employees_url, :notice => 'Employee was successfully created.') }
        else
          format.html { render :action => "new" }
        end
      end
    end
    
    def edit
      @employee = current_account.employees.find_by_identifier(params[:id])
    end
    
    def update
      @employee = current_account.employees.find_by_identifier(params[:id]).first
      employee_params = params[:employee]

      # blank password?
      unless employee_params[:password].present?
        employee_params.delete(:password) 
        employee_params.delete(:password_confirmation) 
      end

      respond_to do |format|
        if @employee.update_attributes(employee_params)
          format.html { redirect_to(employees_url, :notice => 'Employee was successfully updated.') }
        else
          format.html { render :action => "edit" }
        end
      end
    end
    
    def destroy
      @employee = current_account.employees.find_by_identifier(params[:id])
      @employee.destroy
    
      respond_to do |format|
        format.html { redirect_to(employees_url, :notice => 'Employee was successfully deleted.') }
        format.js   {}
      end
    end
  
  end
end
{'fraction_non_alphanumeric': 0.08785283856644466, 'fraction_numerical': 0.0, 'mean_word_length': 2.344644750795334, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '1780886', 'n_tokens_mistral': 936, 'n_tokens_neox': 872, 'n_words': 204}