Sha256: de212460add358bcf38a3ea0d1d511d887b0357d0669ab4f01c3d98a62470f8d
Contents?: true
Size: 1.01 KB
Versions: 2
Compression:
Stored size: 1.01 KB
Contents
module Kiosk module Post extend ActiveSupport::Concern included do self.table_name = 'posts' include Apdown belongs_to :category belongs_to :event 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) validates_length_of :headline, minimum: 3 validates_length_of :content, minimum: 10, maximum: 5000 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ksk-0.1.0 | lib/actives/post.rb |
ksk-0.0.2 | lib/actives/post.rb |