Class: Blog::Post

Inherits:
Wheelhouse::Resource
  • Object
show all
Includes:
Wheelhouse::Resource::Content, Wheelhouse::Resource::Renderable, Wheelhouse::Resource::Versioned
Defined in:
app/models/blog/post.rb

Instance Method Summary collapse

Instance Method Details

#admin_pathObject



69
70
71
# File 'app/models/blog/post.rb', line 69

def admin_path
  persisted? ? blog_post_path(blog_id, self) : blog_posts_path(blog_id)
end

#authorObject



61
62
63
# File 'app/models/blog/post.rb', line 61

def author
  created_by
end

#author_nameObject



57
58
59
# File 'app/models/blog/post.rb', line 57

def author_name
  read_attribute(:author_name) || (author && author.name)
end

#handlerObject



73
74
75
# File 'app/models/blog/post.rb', line 73

def handler
  Blog::PostHandler
end

#pathObject



53
54
55
# File 'app/models/blog/post.rb', line 53

def path
  blog.path(published_at.year, published_at.month, permalink)
end

#published?Boolean



49
50
51
# File 'app/models/blog/post.rb', line 49

def published?
  state == 'Published'
end

#published_atObject



65
66
67
# File 'app/models/blog/post.rb', line 65

def published_at
  read_attribute(:published_at) || Time.now
end