Sha256: 6e8153a4c8b5ce81a672a508e1f406e5feea1f0b6101412bc3ba2b434d1a38ba

Contents?: true

Size: 642 Bytes

Versions: 6

Compression:

Stored size: 642 Bytes

Contents

class Cms::Category < ActiveRecord::Base
  
  set_table_name :cms_categories
  
  # -- Relationships --------------------------------------------------------
  has_many :categorizations,
    :dependent => :destroy
    
  # -- Validations ----------------------------------------------------------
  validates :label,
    :presence   => true,
    :uniqueness => { :scope => :categorized_type }
  validates :categorized_type,
    :presence   => true
    
  # -- Scopes ---------------------------------------------------------------
  default_scope order(:label)
  scope :of_type, lambda { |type|
    where(:categorized_type => type)
  }
  
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-1.4.5 app/models/cms/category.rb
comfortable_mexican_sofa-1.4.4 app/models/cms/category.rb
comfortable_mexican_sofa-1.4.3 app/models/cms/category.rb
comfortable_mexican_sofa-1.4.2 app/models/cms/category.rb
comfortable_mexican_sofa-1.4.1 app/models/cms/category.rb
comfortable_mexican_sofa-1.4.0 app/models/cms/category.rb