Sha256: a92eacfdb343386799c99e202177c29331a195aca6b4426e5721a89cc849fe5e

Contents?: true

Size: 636 Bytes

Versions: 4

Compression:

Stored size: 636 Bytes

Contents

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

  belongs_to :website_nav
  belongs_to :linked_to_item, :polymorphic => true
  
  protected_with_capabilities
  acts_as_nested_set

  include ErpTechSvcs::Utils::DefaultNestedSetMethods

  def path
    linked_to_item.nil? ? url : linked_to_item.path
  end
  
  def positioned_children
    children.sort_by{|child| [child.position]}
  end

  def website_nav
    website_nav_id.nil? ? self.parent.website_nav : WebsiteNav.find(website_nav_id)
  end

  def is_secured?
    self.protected_with_capability?('view')
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
knitkit-2.1.3 app/models/website_nav_item.rb
knitkit-2.1.2 app/models/website_nav_item.rb
knitkit-2.1.1 app/models/website_nav_item.rb
knitkit-2.1.0 app/models/website_nav_item.rb