Sha256: dae0dd95743d76615955cfaeae88b5c49413372771c9a74a260cb65df49160ad
Contents?: true
Size: 911 Bytes
Versions: 3
Compression:
Stored size: 911 Bytes
Contents
module Ksk module Post extend ActiveSupport::Concern included do self.table_name = 'posts' include Apdown belongs_to :category has_many :assets, as: :fileable accepts_nested_attributes_for :assets, allow_destroy: true default_scope -> {order 'created_at DESC'} default_scope -> {where(published: true)} scope :all_posts, -> {except(:where)} scope :top, -> {where(top_news: true)} end def apdown_text content end def content_long "#{intro} #{hidden_text}" end def content_short intro end def intro split_content[0] end def hidden_text split_content[1] end def split_content return [] if read_attribute(:content).blank? read_attribute(:content).split('@@@') end def content_has_more? !hidden_text.blank? end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ksk-0.1.5 | lib/actives/post.rb |
ksk-0.1.4 | lib/actives/post.rb |
ksk-0.1.3 | lib/actives/post.rb |