Sha256: 462b5647774c581867e27e038029fa784c89016ea1720714994b982f70d2ddf4

Contents?: true

Size: 555 Bytes

Versions: 15

Compression:

Stored size: 555 Bytes

Contents

class Ecm::Cms::Navigation < ActiveRecord::Base
  # associations
  has_many :ecm_cms_navigation_items,
           class_name: 'Ecm::Cms::NavigationItem',
           dependent: :destroy,
           foreign_key: 'ecm_cms_navigation_id'

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

  delegate :count, to: :ecm_cms_navigation_items, prefix: true

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

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
ecm_cms2-4.1.0 app/models/ecm/cms/navigation.rb
ecm_cms2-4.0.1 app/models/ecm/cms/navigation.rb
ecm_cms2-4.0.0 app/models/ecm/cms/navigation.rb
ecm_cms2-3.0.3 app/models/ecm/cms/navigation.rb
ecm_cms2-3.0.2 app/models/ecm/cms/navigation.rb
ecm_cms2-3.0.1 app/models/ecm/cms/navigation.rb
ecm_cms2-3.0.0 app/models/ecm/cms/navigation.rb
ecm_cms2-2.1.4 app/models/ecm/cms/navigation.rb
ecm_cms2-2.1.3 app/models/ecm/cms/navigation.rb
ecm_cms2-2.1.2 app/models/ecm/cms/navigation.rb
ecm_cms2-2.1.1 app/models/ecm/cms/navigation.rb
ecm_cms2-2.1.0 app/models/ecm/cms/navigation.rb
ecm_cms2-2.0.4 app/models/ecm/cms/navigation.rb
ecm_cms2-2.0.3 app/models/ecm/cms/navigation.rb
ecm_cms2-2.0.2 app/models/ecm/cms/navigation.rb