<commit_before># frozen_string_literal: true
class UsersController < ApplicationController
  def listads
    @user = User.find(params[:id])
    authorize(@user)

    @type = type_scope
    @status = status_scope

    @ads = @user.ads
                .includes(:user)
                .public_send(@type)
                .paginate(page: params[:page])

    @ads = @ads.public_send(@status) if @status
  end

  def profile
    name_or_id = params[:username]
    @user = User.find_by_username(name_or_id) || User.find(name_or_id)
    authorize(@user)
  end

  private

  def status_scope
    return unless %w(available booked delivered).include?(params[:status])

    params[:status]
  end

  helper_method :status_scope
end<commit_msg>Use preferred ActiveRecord finder<commit_after># frozen_string_literal: true
class UsersController < ApplicationController
  def listads
    @user = User.find(params[:id])
    authorize(@user)

    @type = type_scope
    @status = status_scope

    @ads = @user.ads
                .includes(:user)
                .public_send(@type)
                .paginate(page: params[:page])

    @ads = @ads.public_send(@status) if @status
  end

  def profile
    name_or_id = params[:username]
    @user = User.find_by(username: name_or_id) || User.find(name_or_id)
    authorize(@user)
  end

  private

  def status_scope
    return unless %w(available booked delivered).include?(params[:status])

    params[:status]
  end

  helper_method :status_scope
end
{'fraction_non_alphanumeric': 0.10707070707070707, 'fraction_numerical': 0.0, 'mean_word_length': 3.0490463215258856, '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': '4804968', 'n_tokens_mistral': 476, 'n_tokens_neox': 452, 'n_words': 99}