<commit_before>class UsersController < ApplicationController

  def index
    @family = current_user.families.first
    @users = @family.users
    redirect_to new_user_path, notice: t('flash.no_members') if @users.blank?
  end

  def new
    @user = User.new
  end

  def create
    @user = User.new(params[:user])
    @user.password = <PASSWORD>password
    @user.invited_by = current_user.id
    if @user.save
      @new_family = FamiliesUsers.new(family_id: current_user.families.first.id, user_id: @user.id)
      @new_family.save()
      mail_params = {email: @user.email, current_user_email: current_user.email, url: "http://budget.shellyapp.com"}
      UserMailer.invite_email(mail_params).deliver
      redirect_to users_path, notice: t('flash.success_one', model: t('activerecord.models.user'))
    else
      render action: "new"
    end
  end

  def edit_profile
    @user = current_user
  end

  def update
    @user = current_user
    @user.locale = params[:user][:locale]

    if @user.save
      I18n.locale = @user.locale
      flash.now[:notice] = t("flash.update_one")
      render action: "edit_profile"
    else
      flash.now[:error] = t("flash.fail_changes")
      render action: "edit_profile"
    end
  end

  def destroy
    @user = User.find(params[:id])
    @user.destroy
    redirect_to users_path, notice: t('flash.delete_one', model: t('activerecord.models.user'))
  end
end<commit_msg>Complete new user row with locale value<commit_after>class UsersController < ApplicationController

  def index
    @family = current_user.families.first
    @users = @family.users
    redirect_to new_user_path, notice: t('flash.no_members') if @users.blank?
  end

  def new
    @user = User.new
  end

  def create
    @user = User.new(params[:user])
    @user.password = <PASSWORD>
    @user.invited_by = current_user.id
    @user.locale = params[:locale]
    if @user.save
      @new_family = FamiliesUsers.new(family_id: current_user.families.first.id, user_id: @user.id)
      @new_family.save()
      mail_params = {email: @user.email, current_user_email: current_user.email, url: "http://budget.shellyapp.com"}
      UserMailer.invite_email(mail_params).deliver
      redirect_to users_path, notice: t('flash.success_one', model: t('activerecord.models.user'))
    else
      render action: "new"
    end
  end

  def edit_profile
    @user = current_user
  end

  def update
    @user = current_user
    @user.locale = params[:locale]

    if @user.save
      I18n.locale = @user.locale
      flash.now[:notice] = t("flash.update_one")
      render action: "edit_profile"
    else
      flash.now[:error] = t("flash.fail_changes")
      render action: "edit_profile"
    end
  end

  def destroy
    @user = User.find(params[:id])
    @user.destroy
    redirect_to users_path, notice: t('flash.delete_one', model: t('activerecord.models.user'))
  end
end
{'fraction_non_alphanumeric': 0.11979166666666667, 'fraction_numerical': 0.001388888888888889, 'mean_word_length': 3.306427503736921, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '1347174', 'n_tokens_mistral': 982, 'n_tokens_neox': 947, 'n_words': 203}