Sha256: 3a689a5119a60f02ec4f2f9130a0e08a23064579d95b192790ab1b9f60ec4a5a

Contents?: true

Size: 697 Bytes

Versions: 27

Compression:

Stored size: 697 Bytes

Contents

class Cms::Category < ActiveRecord::Base
  
  ComfortableMexicanSofa.establish_connection(self)
  
  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

27 entries across 27 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-1.4.14 app/models/cms/category.rb
comfortable_mexican_sofa-1.4.13 app/models/cms/category.rb
comfortable_mexican_sofa-1.4.12 app/models/cms/category.rb
comfortable_mexican_sofa-1.4.11 app/models/cms/category.rb
comfortable_mexican_sofa-1.4.10 app/models/cms/category.rb
comfortable_mexican_sofa-1.4.9 app/models/cms/category.rb
comfortable_mexican_sofa-1.4.8 app/models/cms/category.rb