<commit_before>class GrantApportionment < ApplicationRecord

  has_paper_trail on: [:update], only: [:name, :fy_year]

  # Include the object key mixin
  include TransamObjectKey
  #------------------------------------------------------------------------------
  # Callbacks
  #------------------------------------------------------------------------------
  after_initialize                  :set_defaults

  #------------------------------------------------------------------------------
  # Associations
  #------------------------------------------------------------------------------

  belongs_to :grant

  # Has a single funding source
  belongs_to  :sourceable, :polymorphic => true

  belongs_to  :creator, -> { unscope(where: :active) },     :class_name => "User",  :foreign_key => :created_by_user_id

  belongs_to  :updater, -> { unscope(where: :active) },     :class_name => "User",  :foreign_key => :updated_by_user_id

  #------------------------------------------------------------------------------
  # Validations
  #------------------------------------------------------------------------------
  validates :name,                       :presence => true, :uniqueness => true
  validates :fy_year,                         :presence => true, :numericality => {:only_integer => true, :greater_than_or_equal_to => 1970}<commit_msg>TTPLAT-718 grant apportionment name doesn't have to be uniq<commit_after>class GrantApportionment < ApplicationRecord

  has_paper_trail on: [:update], only: [:name, :fy_year]

  # Include the object key mixin
  include TransamObjectKey
  #------------------------------------------------------------------------------
  # Callbacks
  #------------------------------------------------------------------------------
  after_initialize                  :set_defaults

  #------------------------------------------------------------------------------
  # Associations
  #------------------------------------------------------------------------------

  belongs_to :grant

  # Has a single funding source
  belongs_to  :sourceable, :polymorphic => true

  belongs_to  :creator, -> { unscope(where: :active) },     :class_name => "User",  :foreign_key => :created_by_user_id

  belongs_to  :updater, -> { unscope(where: :active) },     :class_name => "User",  :foreign_key => :updated_by_user_id

  #------------------------------------------------------------------------------
  # Validations
  #------------------------------------------------------------------------------
  validates :name,                            :presence => true
  validates :fy_year,                         :presence => true, :numericality => {:only_integer => true, :greater_than_or_equal_to => 1970}
{'fraction_non_alphanumeric': 0.4180749448934607, 'fraction_numerical': 0.004041146216017634, 'mean_word_length': 0.9703328509406657, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 28, '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': '5504405', 'n_tokens_mistral': 632, 'n_tokens_neox': 591, 'n_words': 131}