Sha256: feebcc44996c36a8ed77abcae925ae91874bfc4b80650a3ad6bb432b23ef5969

Contents?: true

Size: 570 Bytes

Versions: 18

Compression:

Stored size: 570 Bytes

Contents

class WebsiteNav < ActiveRecord::Base
  attr_protected :created_at, :updated_at

  protected_with_capabilities

  belongs_to :website

  validates_uniqueness_of :name, :scope => [:website_id], :message => "That Name is Already in Use", :case_sensitive => false

  has_many :website_nav_items, :dependent => :destroy do
    def positioned
      where('parent_id is null').order('position')
    end
  end
  
  def all_menu_items
    self.website_nav_items.collect{|item| item.self_and_descendants}.flatten
  end

  alias :items :website_nav_items
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
knitkit-3.2.0 app/models/website_nav.rb
knitkit-3.0.0 app/models/website_nav.rb
knitkit-2.1.15 app/models/website_nav.rb
knitkit-2.1.14 app/models/website_nav.rb
knitkit-2.1.13 app/models/website_nav.rb
knitkit-2.1.12 app/models/website_nav.rb
knitkit-2.1.11 app/models/website_nav.rb
knitkit-2.1.10 app/models/website_nav.rb
knitkit-2.1.9 app/models/website_nav.rb
knitkit-2.1.8 app/models/website_nav.rb
knitkit-2.1.7 app/models/website_nav.rb
knitkit-2.1.6 app/models/website_nav.rb
knitkit-2.1.5 app/models/website_nav.rb
knitkit-2.1.4 app/models/website_nav.rb
knitkit-2.1.3 app/models/website_nav.rb
knitkit-2.1.2 app/models/website_nav.rb
knitkit-2.1.1 app/models/website_nav.rb
knitkit-2.1.0 app/models/website_nav.rb