<commit_before>module ActiveRecord
  module Associations
    class CountLoader < SingularAssociation
      # Not preloaded behaviour of count_loader association
      # When this method is called, it will be N+1 query
      def load_target
        count_target = reflection.name.to_s.sub(/_count\z/, '').to_sym
        @target = owner.association(count_target).count

        loaded! unless loaded?
        target
      rescue ActiveRecord::RecordNotFound
        reset
      end
    end
  end

  module Reflection
    class CountLoaderReflection < AssociationReflection
      def macro; :count_loader; end

      def association_class
        ActiveRecord::Associations::CountLoader
      end

      def klass
        @klass ||= active_record.send(:compute_type, options[:class_name] || name.to_s.sub(/_count\z/, '').singularize.classify)
      end
    end
  end<commit_msg>s/.count/.size for AR::Associations::Countloader.load_target<commit_after>module ActiveRecord
  module Associations
    class CountLoader < SingularAssociation
      # Not preloaded behaviour of count_loader association
      # When this method is called, it will be N+1 query
      def load_target
        count_target = reflection.name.to_s.sub(/_count\z/, '').to_sym
        @target = owner.association(count_target).size

        loaded! unless loaded?
        target
      rescue ActiveRecord::RecordNotFound
        reset
      end
    end
  end

  module Reflection
    class CountLoaderReflection < AssociationReflection
      def macro; :count_loader; end

      def association_class
        ActiveRecord::Associations::CountLoader
      end

      def klass
        @klass ||= active_record.send(:compute_type, options[:class_name] || name.to_s.sub(/_count\z/, '').singularize.classify)
      end
    end
  end
{'fraction_non_alphanumeric': 0.07739420935412027, 'fraction_numerical': 0.0011135857461024498, 'mean_word_length': 2.823404255319149, 'pattern_counts': {'":': 0, '<': 7, '<?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': '2884865', 'n_tokens_mistral': 491, 'n_tokens_neox': 484, 'n_words': 127}