Sha256: 041364b42fd03045eace984a88ee7597689e21c96ae864d1f5d2e3e9426da0f0
Contents?: true
Size: 899 Bytes
Versions: 6
Compression:
Stored size: 899 Bytes
Contents
module Ecm::Blog class Post < ActiveRecord::Base include Model::Ecm::Comments::CommentableConcern include Model::Ecm::Tags::TaggableConcern # acts as published include ActsAsPublished::ActiveRecord acts_as_published # slugs extend FriendlyId friendly_id :title, use: :slugged belongs_to :creator, class_name: Ecm::Blog.creator_class_name, foreign_key: 'created_by_id' belongs_to :updater, class_name: Ecm::Blog.creator_class_name, foreign_key: 'updated_by_id', optional: true def human title end module Markdown def body(format: nil) case format when :html to_markdown(read_attribute(:body)) else read_attribute(:body) end end private def to_markdown(string) Kramdown::Document.new(string).to_html end end include Markdown end end
Version data entries
6 entries across 6 versions & 1 rubygems