<commit_before>class ProfilesController < ApplicationController 
   
  load_and_authorize_resource

  before_action :set_profile, only: [:show, :edit, :update, :destroy]

  # GET /profiles
  # GET /profiles.json
  def index
    @profiles = Profile.all
  end

  # GET /profiles/1
  # GET /profiles/1.json
  def show
    @users = current_user
    @profile = @users.profile
  end

  # GET /profiles/new
  def new
    @profile = Profile.new
  end

  # POST /profiles
  # POST /profiles.json
  def create
    @profile = Profile.new(profile_params)

    respond_to do |format|
      if @profile.save
        format.html { redirect_to @profile, notice: 'Profil wurde erfolgreich erstellt.' }
        format.json { render :show, status: :created, location: @profile }
      else
        format.html { render :new }
        format.json { render json: @profile.errors, status: :unprocessable_entity }
      end
    end
  end

  # PATCH/PUT /profiles/1
  # PATCH/PUT /profiles/1.json
  def update
    if profile_params[:user_attributes][:password] == profile_params[:user_attributes][:password_confirmation] || profile_params[:user_attributes][:password] == nil
      @profile.user = User.update(@profile.user.id, profile_params[:user_attributes]) # updates the user by updating the given params
      if !current_user.nil?<commit_msg>minor changes<commit_after>class ProfilesController < ApplicationController 
   
  load_and_authorize_resource

  before_action :set_profile, only: [:show, :edit, :update, :destroy]

  # GET /profiles
  # GET /profiles.json
  def index
    @profiles = Profile.all
  end

  # GET /profiles/1
  # GET /profiles/1.json
  def show
    @users = current_user
   
  end

  # GET /profiles/new
  def new
    @profile = Profile.new
  end

  # POST /profiles
  # POST /profiles.json
  def create
    @profile = Profile.new(profile_params)

    respond_to do |format|
      if @profile.save
        format.html { redirect_to @profile, notice: 'Profil wurde erfolgreich erstellt.' }
        format.json { render :show, status: :created, location: @profile }
      else
        format.html { render :new }
        format.json { render json: @profile.errors, status: :unprocessable_entity }
      end
    end
  end

  # PATCH/PUT /profiles/1
  # PATCH/PUT /profiles/1.json
  def update
    if profile_params[:user_attributes][:password] == profile_params[:user_attributes][:password_confirmation] || profile_params[:user_attributes][:password] == nil
      @profile.user = User.update(@profile.user.id, profile_params[:user_attributes]) # updates the user by updating the given params
      if !current_user.nil?
{'fraction_non_alphanumeric': 0.10450038138825324, 'fraction_numerical': 0.0030511060259344014, 'mean_word_length': 3.217041800643087, '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': '2873231', 'n_tokens_mistral': 832, 'n_tokens_neox': 814, 'n_words': 204}