<commit_before>class Question < ActiveRecord::Base
  belongs_to :user
  has_many :answers
  has_many :comments, as: :commentable
  has_many :votes, as: :votable

  validates_presence_of :body
  validates_presence_of :title
  validates_presence_of :user_id

  def vote_count
    self.votes.where(upvote: true).count - self.votes.where(upvote: false).count
  end

  def self.search(words)
    matches = []
    words.split(' ').each do |word|
      matches << Question.all.select { |q| q.title.include?(word) || q.body.include?(word) }
    end
    matches.flatten.uniq
  end
end
<commit_msg>Models: added has_many association to question<commit_after>class Question < ActiveRecord::Base
  belongs_to :user
  has_many :answers
  has_many :tags
  has_many :comments, as: :commentable
  has_many :votes, as: :votable

  validates_presence_of :body
  validates_presence_of :title
  validates_presence_of :user_id

  def vote_count
    self.votes.where(upvote: true).count - self.votes.where(upvote: false).count
  end

  def self.search(words)
    matches = []
    words.split(' ').each do |word|
      matches << Question.all.select { |q| q.title.include?(word) || q.body.include?(word) }
    end
    matches.flatten.uniq
  end
end

{'fraction_non_alphanumeric': 0.11256117455138662, 'fraction_numerical': 0.0, 'mean_word_length': 3.869047619047619, 'pattern_counts': {'":': 0, '<': 9, '<?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': '7111977', 'n_tokens_mistral': 438, 'n_tokens_neox': 435, 'n_words': 95}