<commit_before>class User < ActiveRecord::Base
  belongs_to :district
  has_many :candidates

  has_many :observers, :class_name => "Watching", :foreign_key => "observer_id"
  has_many :subjects, :class_name => "Watching", :foreign_key => "subject_id"

  has_many :endorsers, :class_name => "Endorsement", :foreign_key => "endorser_id"
  has_many :endorsees, :class_name => "Endorsement", :foreign_key => "endorsee_id"


  # Refractor later, and User can watch other user multiple time, need to fix
  def add_watch (user)
      Watching.create(observer: self, subject: user)
  end
end<commit_msg>Fix foreign key references to subj and endorsees<commit_after>class User < ActiveRecord::Base
  belongs_to :district
  has_many :candidates

  has_many :observers, :class_name => "Watching", :foreign_key => "subject_id"
  has_many :subjects, :class_name => "Watching", :foreign_key => "observer_id"

  has_many :endorsers, :class_name => "Endorsement", :foreign_key => "endorsee_id"
  has_many :endorsees, :class_name => "Endorsement", :foreign_key => "endorser_id"



  def add_watch (user)
      Watching.create(observer: self, subject: user)
  end

end
{'fraction_non_alphanumeric': 0.12076455256298871, 'fraction_numerical': 0.0, 'mean_word_length': 5.545454545454546, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, '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': '4500054', 'n_tokens_mistral': 410, 'n_tokens_neox': 389, 'n_words': 99}