<commit_before># == Schema Information
#
# Table name: appliance_types
#
#  id                :integer          not null, primary key
#  name              :string(255)      not null
#  description       :text
#  shared            :boolean          default(FALSE), not null
#  scalable          :boolean          default(FALSE), not null
#  visibility        :string(255)      default("under_development"), not null
#  preference_cpu    :float
#  preference_memory :integer
#  preference_disk   :integer
#  security_proxy_id :integer
#  user_id           :integer
#  created_at        :datetime
#  updated_at        :datetime
#

class ApplianceType < ActiveRecord::Base
  extend Enumerize

  belongs_to :security_proxy
  belongs_to :author, :class_name => 'User', :foreign_key => 'user_id'

  has_many :appliances
  has_many :port_mapping_templates, dependent: :destroy
  has_many :appliance_configuration_templates, dependent: :destroy
  has_many :virtual_machine_templates

  validates_presence_of :name, :visibility
  validates_uniqueness_of :name

  # TODO Perhaps explicit default here is not needed when we have it in migrations; test and remove
  #enumerize :visibility, in: [:under_development, :unpublished, :published], default: :under_development
  enumerize :visibility, in: [:under_development, :unpublished, :published]

  validates :visibility, inclusion: %w(under_development unpublished published)
  validates :shared, inclusion: [true, false]
  validates :scalable, inclusion: [true, false]

  validates :preference_memory, numericality: { only_integer: true, greater_than_or_equal_to: 0, allow_nil: true }
  validates :preference_disk, numericality: { only_integer: true, greater_than_or_equal_to: 0, allow_nil: true }
  validates :preference_cpu, numericality: { greater_than_or_equal_to: 0.0, allow_nil: true }

end
<commit_msg>minor model syntax fix to ApplianceType<commit_after># == Schema Information
#
# Table name: appliance_types
#
#  id                :integer          not null, primary key
#  name              :string(255)      not null
#  description       :text
#  shared            :boolean          default(FALSE), not null
#  scalable          :boolean          default(FALSE), not null
#  visibility        :string(255)      default("under_development"), not null
#  preference_cpu    :float
#  preference_memory :integer
#  preference_disk   :integer
#  security_proxy_id :integer
#  user_id           :integer
#  created_at        :datetime
#  updated_at        :datetime
#

class ApplianceType < ActiveRecord::Base
  extend Enumerize

  belongs_to :security_proxy
  belongs_to :author, class_name: 'User', foreign_key: 'user_id'

  has_many :appliances
  has_many :port_mapping_templates, dependent: :destroy
  has_many :appliance_configuration_templates, dependent: :destroy
  has_many :virtual_machine_templates

  validates_presence_of :name, :visibility
  validates_uniqueness_of :name

  enumerize :visibility, in: [:under_development, :unpublished, :published]

  validates :visibility, inclusion: %w(under_development unpublished published)
  validates :shared, inclusion: [true, false]
  validates :scalable, inclusion: [true, false]

  validates :preference_memory, numericality: { only_integer: true, greater_than_or_equal_to: 0, allow_nil: true }
  validates :preference_disk, numericality: { only_integer: true, greater_than_or_equal_to: 0, allow_nil: true }
  validates :preference_cpu, numericality: { greater_than_or_equal_to: 0.0, allow_nil: true }

end

{'fraction_non_alphanumeric': 0.08376068376068375, 'fraction_numerical': 0.005698005698005698, 'mean_word_length': 4.015714285714286, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2106161', 'n_tokens_mistral': 1079, 'n_tokens_neox': 1037, 'n_words': 280}