Class: Post

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
Publishable, Renderable, Sluggable
Defined in:
app/models/post.rb

Overview

Posts are published if published_at is not nil. TODO: schedule publish by comparing published_at to Time.now

Posts must have a slug, usually based on title.

Posts render body_markdown as body_html on save.

Instance Method Summary collapse

Methods included from Publishable

#draft?, #published?

Instance Method Details

#published_at_slugObject


16
17
18
# File 'app/models/post.rb', line 16

def published_at_slug
  published_at.localtime.strftime('%Y/%m/%d') if published?
end