Sha256: 8863079fa3212ee6d3c8e6f64889629ce0e78f5b7794b5dfde16283ee72d2270

Contents?: true

Size: 656 Bytes

Versions: 1

Compression:

Stored size: 656 Bytes

Contents

# frozen_string_literal: true

class Occams::Cms::Category < ActiveRecord::Base

  self.table_name = "occams_cms_categories"

  # -- Relationships --------------------------------------------------------
  belongs_to :site
  has_many :categorizations,
    dependent: :destroy

  # -- Validations ----------------------------------------------------------
  validates :label,
    presence:   true,
    uniqueness: { scope: %i[categorized_type site_id] }
  validates :categorized_type,
    presence:   true

  # -- Scopes ---------------------------------------------------------------
  scope :of_type, ->(type) {
    where(categorized_type: type)
  }

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
occams-1.0.0 app/models/occams/cms/category.rb