<commit_before>class Equipment < Asset

  # Callbacks
  after_initialize :set_defaults

  #------------------------------------------------------------------------------
  # Associations common to all equipment assets
  #------------------------------------------------------------------------------

  validates :quantity,        :presence => :true, :numericality => {:only_integer => :true, :greater_than_or_equal_to => 1}
  validates :quantity_units,  :presence => true
  validates :quantity_units,     :presence => true

  #------------------------------------------------------------------------------
  # Scopes
  #------------------------------------------------------------------------------
  # set the default scope
  default_scope { where(:asset_type_id => AssetType.where(:class_name => self.name).pluck(:id)) }

  #------------------------------------------------------------------------------
  #
  # Class Methods
  #
  #------------------------------------------------------------------------------

  def self.allowable_params
    [
      :quantity,
      :quantity_units,
      :quantity_units
    ]
  end

  def transfer new_organization_id
    transferred_asset = self.copy
    org = Organization.where(:id => new_organization_id).first

    transferred_asset.in_service_date = nil
    transferred_asset.organization = org
    transferred_asset.purchase_cost = nil
    transferred_asset.purchase_date = nil
    transferred_asset.purchased_new = nil<commit_msg>[Fixes #119035731] purchased_new is now set to false.<commit_after>class Equipment < Asset

  # Callbacks
  after_initialize :set_defaults

  #------------------------------------------------------------------------------
  # Associations common to all equipment assets
  #------------------------------------------------------------------------------

  validates :quantity,        :presence => :true, :numericality => {:only_integer => :true, :greater_than_or_equal_to => 1}
  validates :quantity_units,  :presence => true
  validates :quantity_units,     :presence => true

  #------------------------------------------------------------------------------
  # Scopes
  #------------------------------------------------------------------------------
  # set the default scope
  default_scope { where(:asset_type_id => AssetType.where(:class_name => self.name).pluck(:id)) }

  #------------------------------------------------------------------------------
  #
  # Class Methods
  #
  #------------------------------------------------------------------------------

  def self.allowable_params
    [
      :quantity,
      :quantity_units,
      :quantity_units
    ]
  end

  def transfer new_organization_id
    transferred_asset = self.copy
    org = Organization.where(:id => new_organization_id).first

    transferred_asset.in_service_date = nil
    transferred_asset.organization = org
    transferred_asset.purchase_cost = nil
    transferred_asset.purchase_date = nil
    transferred_asset.purchased_new = false
{'fraction_non_alphanumeric': 0.3757495003331113, 'fraction_numerical': 0.0036642238507661557, 'mean_word_length': 1.1526881720430107, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, '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': '4975056', 'n_tokens_mistral': 702, 'n_tokens_neox': 661, 'n_words': 134}