<commit_before>module Mongoid #:nodoc:
  module Associations #:nodoc:
    class BelongsTo #:nodoc:
      include Decorator

      # Creates the new association by setting the internal 
      # document as the passed in Document. This should be the
      # parent.
      #
      # All method calls on this object will then be delegated
      # to the internal document itself.
      def initialize(name, document, options = {})
        @document = document.parent
        decorate!
      end

      # Returns the parent document. The id param is present for
      # compatibility with rails, however this could be overwritten 
      # in the future.
      def find(id)
        @document
      end

      class << self
        # Perform an update of the relationship of the parent and child. This
        # is initialized by setting a parent object as the association on the
        # +Document+. Will properly set a has_one or a has_many.
        def update(parent, child, name, options = {})
          name = child.class.name.demodulize.downcase
          has_one = parent.associations[name]
          child.parentize(parent, name) if has_one
          child.parentize(parent, name.tableize) unless has_one
          child.notify
          parent
        end
      end
    end
  end
end<commit_msg>Updating update - fo sho<commit_after>module Mongoid #:nodoc:
  module Associations #:nodoc:
    class BelongsTo #:nodoc:
      include Decorator

      # Creates the new association by setting the internal 
      # document as the passed in Document. This should be the
      # parent.
      #
      # All method calls on this object will then be delegated
      # to the internal document itself.
      def initialize(name, document, options = {})
        @document = document.parent
        decorate!
      end

      # Returns the parent document. The id param is present for
      # compatibility with rails, however this could be overwritten 
      # in the future.
      def find(id)
        @document
      end

      class << self
        # Perform an update of the relationship of the parent and child. This
        # is initialized by setting a parent object as the association on the
        # +Document+. Will properly set a has_one or a has_many.
        def update(parent, child, name, options = {})
          name = child.class.name.demodulize.downcase
          has_one = parent.associations[name]
          if has_one
            child.parentize(parent, name)
          else
            child.parentize(parent, name.tableize)
          end
          child.notify
          parent
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.059582542694497156, 'fraction_numerical': 0.0, 'mean_word_length': 2.0580046403712298, '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': '1673789', 'n_tokens_mistral': 685, 'n_tokens_neox': 673, 'n_words': 276}