Class: Page

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

Instance Method Summary collapse

Instance Method Details

#format_markupObject



19
20
21
22
23
# File 'app/models/page.rb', line 19

def format_markup
  if not self.body_raw.nil?
    self.body = RedCloth.new(self.body_raw,[:sanitize_html, :filter_html]).to_html
  end
end

#publishedObject



25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/models/page.rb', line 25

def published
  #self.published_at ||= Time.now unless self.is_active == 0
  if self.is_active == 0
    if !self.published_at.blank?
      self.published_at = nil
    end
  else
    if self.published_at.blank?
      self.published_at = Time.now
    end
  end
end

#to_paramObject



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

def to_param
  return permalink unless permalink.blank?
  title.to_url
end