Sha256: 775e7b66d1b6d85e5afa3fc69f72993b2f9fda9660adf337daae59b7e439c7df

Contents?: true

Size: 663 Bytes

Versions: 6

Compression:

Stored size: 663 Bytes

Contents

class Ecm::Cms::Navigation < ActiveRecord::Base
  self.table_name = 'ecm_cms_navigations'

  # associations
  has_many :ecm_cms_navigation_items,
           :class_name => 'Ecm::Cms::NavigationItem',
           :dependent => :destroy,
           :foreign_key => 'ecm_cms_navigation_id'

  # attributes
  attr_accessible :locale,
                  :name,
                  :slug

  # validations
  validates :locale, :inclusion => I18n.available_locales.map(&:to_s),
                     :allow_nil => true
  validates :name, :presence => true,
                   :uniqueness => { :scope => [ :locale ] }

  def to_s
    "#{self.name} (#{self.locale})"
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ecm_cms-1.0.5.pre app/models/ecm/cms/navigation.rb
ecm_cms-1.0.4.pre app/models/ecm/cms/navigation.rb
ecm_cms-1.0.3.pre app/models/ecm/cms/navigation.rb
ecm_cms-1.0.2.pre app/models/ecm/cms/navigation.rb
ecm_cms-1.0.1.pre app/models/ecm/cms/navigation.rb
ecm_cms-1.0.0.pre app/models/ecm/cms/navigation.rb