<commit_before># This is the parent Association class which defines certain class variables (valid_options) and
# instance variables (model, name, scope, options, reflection) which would be common across all the associations that we known today in Rails..
# Every association need to have the values of these variables set and they are used at multiple places

module ActiveRecord::Associations::Builder
  class Association #:nodoc:
    class << self
      attr_accessor :valid_options
    end

    self.valid_options = [:class_name, :foreign_key, :validate]

    attr_reader :model, :name, :scope, :options, :reflection

    def self.build(*args, &block)
      new(*args, &block).build
    end

    def initialize(model, name, scope, options)
      raise ArgumentError, "association names must be a Symbol" unless name.kind_of?(Symbol)

      @model   = model
      @name    = name

      if scope.is_a?(Hash)
        @scope   = nil
        @options = scope
      else<commit_msg>Added some more documentation for ActiveRecord::Associations::Builder::Association class<commit_after># This is the parent Association class which defines certain class variables (valid_options) and
# instance variables (model, name, scope, options, reflection) which would be common across all the associations that we known today in Rails..
# Every association need to have the values of these variables set and they are used at multiple places
# The heirarchy is defined as follows:
#  Association 
#    - SingularAssociation
#      - BelongsTo
#      - HasOne
#    - CollectionAssociation
#      - HasMany
#      - HasAndBelongsToMany
#
# The HasMany :Through association is a special case of HasMany association with the :through option set for it
#

module ActiveRecord::Associations::Builder
  class Association #:nodoc:
    class << self
      attr_accessor :valid_options
    end

    self.valid_options = [:class_name, :foreign_key, :validate]

    attr_reader :model, :name, :scope, :options, :reflection

    def self.build(*args, &block)
      new(*args, &block).build
    end

    def initialize(model, name, scope, options)
      raise ArgumentError, "association names must be a Symbol" unless name.kind_of?(Symbol)

      @model   = model
      @name    = name

      if scope.is_a?(Hash)
        @scope   = nil
        @options = scope
      else
{'fraction_non_alphanumeric': 0.079317697228145, 'fraction_numerical': 0.0, 'mean_word_length': 3.4180790960451977, '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': '5563497', 'n_tokens_mistral': 637, 'n_tokens_neox': 619, 'n_words': 246}