Class: Thesis::Page

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/thesis/models/page.rb

Instance Method Summary collapse

Instance Method Details

#content(name, content_type = :html) ⇒ Object



23
24
25
26
# File 'lib/thesis/models/page.rb', line 23

def content(name, content_type = :html)
  pc = find_or_create_page_content(name, content_type)
  pc.render
end

#pathObject



28
29
30
# File 'lib/thesis/models/page.rb', line 28

def path
  self.slug
end

#update_slugObject



14
15
16
17
# File 'lib/thesis/models/page.rb', line 14

def update_slug
  self.slug = "/" << self.name.parameterize
  self.slug = "#{parent.slug.to_s}#{self.slug.to_s}" if parent
end

#update_subpage_slugsObject



19
20
21
# File 'lib/thesis/models/page.rb', line 19

def update_subpage_slugs
  subpages.each(&:save) if slug_changed?
end