Class: Blogr::Post
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Blogr::Post
- Defined in:
- app/models/blogr/post.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#content_rendered ⇒ String
The Markdown content rendered to HTML.
-
#date_parsed ⇒ String
The date parsed as 04 November 2013.
- #tag_list ⇒ Object
- #tag_list=(names) ⇒ Object
- #to_param ⇒ Object
Class Method Details
Instance Method Details
#content_rendered ⇒ String
The Markdown content rendered to HTML
35 36 37 |
# File 'app/models/blogr/post.rb', line 35 def content_rendered markdown(content).html_safe end |
#date_parsed ⇒ String
The date parsed as 04 November 2013
28 29 30 |
# File 'app/models/blogr/post.rb', line 28 def date_parsed published && published_at.present? ? published_at.strftime("%d %B %Y") : "" end |
#tag_list ⇒ Object
49 50 51 |
# File 'app/models/blogr/post.rb', line 49 def tag_list .map(&:name).join(", ") end |
#tag_list=(names) ⇒ Object
53 54 55 56 57 |
# File 'app/models/blogr/post.rb', line 53 def tag_list=(names) self. = names.split(",").map do |n| Blogr::Tag.where(name: n.strip).first_or_create! end end |
#to_param ⇒ Object
20 21 22 |
# File 'app/models/blogr/post.rb', line 20 def to_param permalink end |