Class: Dust::Post
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Dust::Post
show all
- Includes:
- Menu::ItemDependency
- Defined in:
- app/models/dust/post.rb
Instance Method Summary
collapse
#active, #active=, #match_path, #menu, #menu=, #nav_link, #nav_link=
Instance Method Details
#filename ⇒ Object
30
31
32
|
# File 'app/models/dust/post.rb', line 30
def filename
url_title
end
|
#filename=(filename = "") ⇒ Object
34
35
36
|
# File 'app/models/dust/post.rb', line 34
def filename=(filename="")
self..url = "/post/#{slug}"
end
|
#published_date ⇒ Object
14
15
16
|
# File 'app/models/dust/post.rb', line 14
def published_date
self.published_at ? self.published_at.strftime("%Y/%m/%d") : Time.now.strftime("%Y/%m/%d")
end
|
#published_date=(date_str) ⇒ Object
18
19
20
|
# File 'app/models/dust/post.rb', line 18
def published_date=(date_str)
self.published_at = Time.parse date_str
end
|
#share_types ⇒ Object
10
11
12
|
# File 'app/models/dust/post.rb', line 10
def share_types
['Facebook', 'Twitter']
end
|
#slug ⇒ Object
22
23
24
|
# File 'app/models/dust/post.rb', line 22
def slug
"#{published_date}/#{url_title.parameterize}"
end
|
#url_title ⇒ Object
26
27
28
|
# File 'app/models/dust/post.rb', line 26
def url_title
title.blank? ? "empty-title" : title
end
|