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.5.11 app/models/cms/category.rb
comfortable_mexican_sofa-1.5.10 app/models/cms/category.rb
comfortable_mexican_sofa-1.5.9 app/models/cms/category.rb
comfortable_mexican_sofa-1.5.8 app/models/cms/category.rb
comfortable_mexican_sofa-1.5.7 app/models/cms/category.rb
comfortable_mexican_sofa-1.5.6 app/models/cms/category.rb
comfortable_mexican_sofa-1.5.5 app/models/cms/category.rb
comfortable_mexican_sofa-1.5.4 app/models/cms/category.rb
comfortable_mexican_sofa-1.5.3 app/models/cms/category.rb
comfortable_mexican_sofa-1.5.2 app/models/cms/category.rb
comfortable_mexican_sofa-1.5.1 app/models/cms/category.rb
comfortable_mexican_sofa-1.5.0 app/models/cms/category.rb
comfortable_mexican_sofa-1.4.22 app/models/cms/category.rb
comfortable_mexican_sofa-1.4.21 app/models/cms/category.rb
comfortable_mexican_sofa-1.4.20 app/models/cms/category.rb
comfortable_mexican_sofa-1.4.19 app/models/cms/category.rb
comfortable_mexican_sofa-1.4.18 app/models/cms/category.rb
comfortable_mexican_sofa-1.4.17 app/models/cms/category.rb
comfortable_mexican_sofa-1.4.16 app/models/cms/category.rb
comfortable_mexican_sofa-1.4.15 app/models/cms/category.rb