<commit_before>class UsersController < ApplicationController
  before_action :set_user, only: [:show, :edit, :update, :destroy]
  before_action :require_login, except: [:new, :create]

  def new
    @user.new
  end

  def create
    @user = User.new(user_params)
    respond_to do |format|
      if @user.save
        format.html { redirect_to @user, notice: 'User Created' }
        format.json { render :user, status: :created, location: @user }
      else
        format.html { redirect_to :new_user }
        format.json { render json: @user.errors, status: :unprocessable_entity }
      end
    end
  end

  def show
  end

  def edit
  end

  def update
    respond_to do |format|
      if @user.update(user_params)
        format.html { redirect_to @user, notice: 'User Updated' }
        format.json { render :show, status: :updated, location: @user }
      else
        format.html { redirect to :edit }
        format.json { render json: @user.errors, status: :unprocessable_entity }
      end
    end<commit_msg>Add redirect to user creation<commit_after>class UsersController < ApplicationController
  before_action :set_user, only: [:show, :edit, :update, :destroy]
  before_action :require_login, except: [:new, :create]

  def new
    @user = User.new
  end

  def create
    @user = User.new(user_params)
    respond_to do |format|
      if @user.save
        set_session
        format.html { redirect_to @user, notice: 'User Created' }
        format.json { render :user, status: :created, location: @user }
      else
        format.html { redirect_to :new_user }
        format.json { render json: @user.errors, status: :unprocessable_entity }
      end
    end
  end

  def show
  end

  def edit
  end

  def update
    respond_to do |format|
      if @user.update(user_params)
        format.html { redirect_to @user, notice: 'User Updated' }
        format.json { render :show, status: :updated, location: @user }
      else
        format.html { redirect to :edit }
        format.json { render json: @user.errors, status: :unprocessable_entity }
      end
    end
{'fraction_non_alphanumeric': 0.09909047391096218, 'fraction_numerical': 0.0, 'mean_word_length': 2.6925795053003534, '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': '3625281', 'n_tokens_mistral': 648, 'n_tokens_neox': 637, 'n_words': 191}