Sha256: fdaaaa7b3593d87f258c24f2e685a29c10354fa3e15c71a79e91cf03331a361b
Contents?: true
Size: 822 Bytes
Versions: 1
Compression:
Stored size: 822 Bytes
Contents
require 'kramdown' module Kawara class Article < ActiveRecord::Base extend FriendlyId friendly_id :title, use: :slugged belongs_to :category has_many :images, class_name: 'ArticleImage', dependent: :destroy has_many :articles_tags, dependent: :destroy has_many :tags, through: :articles_tags has_many :articles_meta_tags, dependent: :destroy has_many :meta_tags, through: :articles_meta_tags enum status: { draft: 0, published: 10 } accepts_attachments_for :images scope :latest, -> (limit=10) { published.last(limit).reverse } def self.find_from_published(id) friendly.published.find(id) end def html_content(auto_ids: true) Kramdown::Document.new(content, auto_ids: auto_ids).to_html end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kawara-0.2.0 | app/models/kawara/article.rb |