Class: Content

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

Instance Method Summary collapse

Instance Method Details

#body_to_htmlObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/models/content.rb', line 7

def body_to_html
  case content_type
    when "text/textile"
      if body.blank?
        ""
      else
        textilized = RedCloth.new(body, [ :hard_breaks ])
        textilized.hard_breaks = true if textilized.respond_to?("hard_breaks=")
        textilized.to_html
      end
    when "text/html"
      body
    else
      body
  end
end

#titleObject



23
24
25
# File 'app/models/content.rb', line 23

def title
  truncate strip_html( body )
end