Sha256: c9dae3f34f37f64097a2939d8f7bfdac6a72fe6fa9892ba7c7601d2c5da6ad66

Contents?: true

Size: 628 Bytes

Versions: 3

Compression:

Stored size: 628 Bytes

Contents

class Comfy::Cms::Category < ActiveRecord::Base
  self.table_name = "comfy_cms_categories"

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

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

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

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-2.0.2 app/models/comfy/cms/category.rb
comfortable_mexican_sofa-2.0.1 app/models/comfy/cms/category.rb
comfortable_mexican_sofa-2.0.0 app/models/comfy/cms/category.rb