Class: PageLink

Inherits:
MenuLink
  • Object
show all
Defined in:
app/models/page_link.rb

Instance Method Summary collapse

Methods inherited from MenuLink

#clone, #kind, #kind=, #url_and_children_urls, #url_and_parent_urls, #url_match?, #url_with_target

Instance Method Details

#page_and_children_pagesObject



12
13
14
15
16
# File 'app/models/page_link.rb', line 12

def page_and_children_pages
  [self.target] +
    self.children.all(:conditions => {:type => 'PageLink'}).
    map(&:page_and_children_pages)
end

#urlObject



2
3
4
5
6
7
8
9
10
# File 'app/models/page_link.rb', line 2

def url
   #TODO update syntax with target method
   page = Page.find_by_id(self.target_id)
   if page
    "/#{page.url}"
   else
     "#"
   end
end