<commit_before>module Cfp
  class ProfilesController < BaseController
    skip_before_filter :check_for_profile, :except => [ :show ]
    before_filter :load_profile, :only => [ :edit, :update ]

    def new
      @profile = Cfp::Profile.new
    end

    def create
      @profile = Profile.new profile_params
      if @profile.save
        current_user.profile = @profile
        current_user.save
        redirect_to :profile
      else
        render :action => :new
      end
    end

    def show
      @profile = current_user.profile
    end

    def edit
    end

    def update
      #if @profile.update_attributes params[:profile]
      if @profile.update_attributes profile_params
        redirect_to :profile, :notice => t('profile.edited.success')
      else
        render :action => :edit
      end<commit_msg>Fix a bug when a user went to the edit profile page without a profile<commit_after>module Cfp
  class ProfilesController < BaseController
    skip_before_filter :check_for_profile, :except => [ :show ]
    before_filter :load_profile, :only => [ :edit, :update ]

    def new
      @profile = Cfp::Profile.new
    end

    def create
      @profile = Profile.new profile_params
      if @profile.save
        current_user.profile = @profile
        current_user.save
        redirect_to :profile
      else
        render :action => :new
      end
    end

    def show
      @profile = current_user.profile
    end

    def edit
      redirect_to :new_profile unless @profile
    end

    def update
      #if @profile.update_attributes params[:profile]
      if @profile.update_attributes profile_params
        redirect_to :profile, :notice => t('profile.edited.success')
      else
        render :action => :edit
      end
{'fraction_non_alphanumeric': 0.07766990291262135, 'fraction_numerical': 0.0, 'mean_word_length': 2.415204678362573, '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': '1072241', 'n_tokens_mistral': 497, 'n_tokens_neox': 484, 'n_words': 141}