Sha256: eb44af5b5ee6d8aa98e5d7246c7ca4b2e8dad8ec0943c3323032cd2b3acf92b7

Contents?: true

Size: 767 Bytes

Versions: 12

Compression:

Stored size: 767 Bytes

Contents

class Cms::Category < ActiveRecord::Base
  
  ComfortableMexicanSofa.establish_connection(self)
  
  self.table_name = 'cms_categories'
  
  # -- Relationships --------------------------------------------------------
  belongs_to :site
  has_many :categorizations,
    :dependent => :destroy
    
  # -- Validations ----------------------------------------------------------
  validates :site_id, 
    :presence   => true
  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

12 entries across 12 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-1.6.14 app/models/cms/category.rb
comfortable_mexican_sofa-1.6.13 app/models/cms/category.rb
comfortable_mexican_sofa-1.6.12 app/models/cms/category.rb
comfortable_mexican_sofa-1.6.11 app/models/cms/category.rb
comfortable_mexican_sofa-1.6.10 app/models/cms/category.rb
comfortable_mexican_sofa-1.6.9 app/models/cms/category.rb
comfortable_mexican_sofa-1.6.8 app/models/cms/category.rb
comfortable_mexican_sofa-1.6.7 app/models/cms/category.rb
comfortable_mexican_sofa-1.6.6 app/models/cms/category.rb
comfortable_mexican_sofa-1.6.5 app/models/cms/category.rb
comfortable_mexican_sofa-1.6.4 app/models/cms/category.rb
comfortable_mexican_sofa-1.6.3 app/models/cms/category.rb