<commit_before>class ApplicationController < ActionController::Base
  protect_from_forgery with: :exception
  
  def home
    return redirect_to groups_url if current_user
    
    render layout: "landing"
  end
  
  def authenticate_current_user!
    if session[:user_id].blank?
      flash[:info] = "Please sign in with twitter to access this page"
      return redirect_to root_url, status: 301
    end
  end
  
    def current_user
      begin
        User.find(session[:user_id]) unless session[:user_id].blank?
      rescue ActiveRecord::RecordNotFound
        session.delete(:user_id)
        nil
      end
    end
end<commit_msg>refactor current_user<commit_after>class ApplicationController < ActionController::Base
  protect_from_forgery with: :exception
  
  def home
    return redirect_to groups_url if current_user
    
    render layout: "landing"
  end
  
  def authenticate_current_user!
    if current_user.nil?
      session[:user_id] = nil
      flash[:info] = "Please sign in to access this page"
      return redirect_to root_url, status: 301
    end
  end

  def current_user
    @current_user ||= User.where(id: session[:user_id]).first
  end
end
{'fraction_non_alphanumeric': 0.06837606837606838, 'fraction_numerical': 0.005128205128205128, 'mean_word_length': 3.2581818181818183, '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': '660766', 'n_tokens_mistral': 356, 'n_tokens_neox': 346, 'n_words': 96}