<commit_before>class Trick < ActiveRecord::Base
  MAX_CARDS = 4
  belongs_to :round
  has_many   :cards # TODO: dependent nullify (all refs become null)
  # NOTE: generally try not to delete data, store the date on which it become 'deleted' etc.

  validates :round, presence: true
  validates :number_in_round, numericality: { greater_than: 0 }

  scope :active,           -> { where("cards_count < ?", MAX_CARDS) }
  scope :inactive,         -> { where(cards_count: MAX_CARDS) }
  scope :in_playing_order, -> { order(number_in_round: :asc) }

  def winning_player
    cards.highest.player
  end
end<commit_msg>Add depdendent: :nullify to trick -> cards<commit_after>class Trick < ActiveRecord::Base
  MAX_CARDS = 4
  belongs_to :round
  has_many   :cards, dependent: :nullify

  validates :round, presence: true
  validates :number_in_round, numericality: { greater_than: 0 }

  scope :active,           -> { where("cards_count < ?", MAX_CARDS) }
  scope :inactive,         -> { where(cards_count: MAX_CARDS) }
  scope :in_playing_order, -> { order(number_in_round: :asc) }

  def winning_player
    cards.highest.player
  end
end
{'fraction_non_alphanumeric': 0.1068904593639576, 'fraction_numerical': 0.0035335689045936395, 'mean_word_length': 3.720833333333333, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 10, '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': '5588028', 'n_tokens_mistral': 391, 'n_tokens_neox': 371, 'n_words': 99}