Class: Thesis::Page
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Thesis::Page
- Defined in:
- lib/thesis/models/page.rb
Instance Method Summary collapse
- #content(name, content_type = :html) ⇒ Object
- #path ⇒ Object
- #update_slug ⇒ Object
- #update_subpage_slugs ⇒ Object
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 |
#path ⇒ Object
28 29 30 |
# File 'lib/thesis/models/page.rb', line 28 def path self.slug end |
#update_slug ⇒ Object
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_slugs ⇒ Object
19 20 21 |
# File 'lib/thesis/models/page.rb', line 19 def update_subpage_slugs subpages.each(&:save) if slug_changed? end |