<commit_before>class UsersController < ApplicationController
  before_action :set_user, only: [:edit, :update]

  def login
    session["user_id"] = params["id"]
    @current_user ||= User.find_by_id(session["user_id"])
    redirect_to home_url
  end

  def logout
    session["user_id"] = nil
    @current_user = nil
    redirect_to root_url
  end    
  
  # GET /users/1/edit
  def edit
  end

  # PATCH/PUT /users/1
  # PATCH/PUT /users/1.json
  def update
    respond_to do |format|
      if @user.update(user_params)
        format.html { redirect_to root_url, notice: 'User was successfully updated.' }
        format.json { render :show, status: :ok, location: @user }
      else
        format.html { render :edit }
        format.json { render json: @user.errors, status: :unprocessable_entity }
      end
    end
  end

  private
    # Use callbacks to share common setup or constraints between actions.
    def set_user
      @user = User.find(params[:id])
    end

    # Never trust parameters from the scary internet, only allow the white list through.
    def user_params
      params.require(:user).permit(:name, :npi)
    end
end
<commit_msg>require first name, last name, role id for user<commit_after>class UsersController < ApplicationController
  before_action :set_user, only: [:edit, :update]

  def login
    session["user_id"] = params["id"]
    @current_user ||= User.find_by_id(session["user_id"])
    redirect_to home_url
  end

  def logout
    session["user_id"] = nil
    @current_user = nil
    redirect_to root_url
  end

  # GET /users/1/edit
  def edit
  end

  # PATCH/PUT /users/1
  # PATCH/PUT /users/1.json
  def update
    respond_to do |format|
      if @user.update(user_params)
        format.html { redirect_to root_url, notice: 'User was successfully updated.' }
        format.json { render :show, status: :ok, location: @user }
      else
        format.html { render :edit }
        format.json { render json: @user.errors, status: :unprocessable_entity }
      end
    end
  end

  private
    # Use callbacks to share common setup or constraints between actions.
    def set_user
      @user = User.find(params[:id])
    end

    # Never trust parameters from the scary internet, only allow the white list through.
    def user_params
      params.require(:user).permit(:first_name, :last_name, :npi, :role_id)
    end
end

{'fraction_non_alphanumeric': 0.09696458684654301, 'fraction_numerical': 0.002529510961214165, 'mean_word_length': 2.88379705400982, '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': '6700733', 'n_tokens_mistral': 751, 'n_tokens_neox': 739, 'n_words': 220}