Class: DocumentationEditor::Page

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/documentation_editor/page.rb

Instance Method Summary collapse

Instance Method Details

#add_revision!(content, publish = false, author_id = nil) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'app/models/documentation_editor/page.rb', line 15

def add_revision!(content, publish = false, author_id = nil)
  r = revisions.build
  r.author_id = author_id
  r.content = content
  r.save!
  if publish
    self.published_revision_id = r.id
    save!
  end
  r
end

#languages_rawObject



31
32
33
# File 'app/models/documentation_editor/page.rb', line 31

def languages_raw
  self.languages.join(',')
end

#languages_raw=(v) ⇒ Object



35
36
37
# File 'app/models/documentation_editor/page.rb', line 35

def languages_raw=(v)
  self.languages = v.to_s.split(/\s*,\s*/).reject { |x| x.blank? }
end

#thumbnail_urlObject



27
28
29
# File 'app/models/documentation_editor/page.rb', line 27

def thumbnail_url
  thumbnail.try(:image).try(:url)
end