Sha256: 28bf504010ad1fe0dee2c1816c256ff95f50f191d6f2326b2e2f9ea1827b340b

Contents?: true

Size: 962 Bytes

Versions: 6

Compression:

Stored size: 962 Bytes

Contents

module Workarea
  class Content::BlogEntry
    include ApplicationDocument
    include Mongoid::Document::Taggable
    include Navigable
    include Contentable
    include FeaturedProducts
    include Workarea::Releasable

    field :name, type: String, localize: true
    field :author, type: String
    field :summary, type: String
    field :comment_count, type: Integer, default: 0
    field :featured, type: Boolean, default: false
    field :written_at, type: DateTime, default: -> { Time.now }
    field :thumbnail_image, type: String

    belongs_to :blog,
               class_name: 'Workarea::Content::Blog',
               index: true

    has_many :comments,
             class_name: 'Workarea::Content::BlogComment',
             inverse_of: :entry

    validates :name, presence: true
    validates :author, presence: true

    scope :newest, -> { desc(:updated_at) }

    def has_thumbnail_image?
      thumbnail_image.present?
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
workarea-blog-3.5.2 app/models/workarea/content/blog_entry.rb
workarea-blog-3.5.1 app/models/workarea/content/blog_entry.rb
workarea-blog-3.5.0 app/models/workarea/content/blog_entry.rb
workarea-blog-3.4.9 app/models/workarea/content/blog_entry.rb
workarea-blog-3.4.8 app/models/workarea/content/blog_entry.rb
workarea-blog-3.4.7 app/models/workarea/content/blog_entry.rb