Class: CortexReaver::Journal

Inherits:
Object
  • Object
show all
Includes:
Model::Renderer
Defined in:
lib/cortex_reaver/model/journal.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Model::Renderer

#bluecloth, #erubis_filter, #macro, #render, #render_comment, #sanitize_html, #syntax_highlight

Methods included from Ramaze::Helper::Form

#attr_h, #errors_list, #errors_on, #form_for, #form_p, #form_submit

Methods included from Ramaze::Helper::Attachments

#delete_attachment, included

Methods included from Ramaze::Helper::Pages

#page_navigation, #page_navigation_helper, #page_select, #subpage_navigation

Class Method Details

.atom_urlObject



20
21
22
# File 'lib/cortex_reaver/model/journal.rb', line 20

def self.atom_url
  '/journals/atom'
end

.get(id) ⇒ Object



24
25
26
# File 'lib/cortex_reaver/model/journal.rb', line 24

def self.get(id)
  self[:name => id] || self[id]
end

.recentObject



28
29
30
# File 'lib/cortex_reaver/model/journal.rb', line 28

def self.recent
  reverse_order(:created_on).limit(16)
end

.urlObject



32
33
34
# File 'lib/cortex_reaver/model/journal.rb', line 32

def self.url
  '/journals'
end

Instance Method Details

#atom_urlObject



36
37
38
# File 'lib/cortex_reaver/model/journal.rb', line 36

def atom_url
  '/journals/atom/' + name
end

#to_sObject



44
45
46
# File 'lib/cortex_reaver/model/journal.rb', line 44

def to_s
  title || name
end

#urlObject



40
41
42
# File 'lib/cortex_reaver/model/journal.rb', line 40

def url
  '/journals/show/' + name
end

#validateObject



48
49
50
51
52
53
# File 'lib/cortex_reaver/model/journal.rb', line 48

def validate
  validates_unique :name
  validates_presence :name
  validates_max_length 255, :name
  validates_presence :title
end