Class: Enki::Page

Inherits:
ActiveRecord::Base
  • Object
show all
Extended by:
PaginationShim
Defined in:
app/models/enki/page.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from PaginationShim

paginated, paginated_pages

Class Method Details

.build_for_preview(params) ⇒ Object



15
16
17
18
19
# File 'app/models/enki/page.rb', line 15

def build_for_preview(params)
  page = Page.new(params)
  page.apply_filter
  page
end

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'app/models/enki/page.rb', line 26

def active?
  true
end

#apply_filterObject



22
23
24
# File 'app/models/enki/page.rb', line 22

def apply_filter
  self.body_html = EnkiFormatter.format_as_xhtml(self.body)
end

#destroy_with_undoObject



30
31
32
33
34
35
# File 'app/models/enki/page.rb', line 30

def destroy_with_undo
  transaction do
    self.destroy
    return DeletePageUndo.create_undo(self)
  end
end

#generate_slugObject



37
38
39
40
# File 'app/models/enki/page.rb', line 37

def generate_slug
  self.slug = self.title.dup if self.slug.blank?
  self.slug.slugorize!
end