Sha256: 378cb0fc0921a01ceacee2fd9a66d3ca8f96379b38b7209edd441ae13a1287af

Contents?: true

Size: 587 Bytes

Versions: 1

Compression:

Stored size: 587 Bytes

Contents

class Content < ActiveRecord::Base
  has_many :meta_datas
  has_many :page_elements, :dependent => :destroy
  has_many :pages, :through => :page_elements
  
  
  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
  def title
    truncate strip_html( body )
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
compages-0.4.0 app/models/content.rb