Class: Homesteading::Post
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Homesteading::Post
- Defined in:
- app/models/homesteading/post.rb
Instance Method Summary collapse
Instance Method Details
#name ⇒ Object
28 29 30 |
# File 'app/models/homesteading/post.rb', line 28 def name [title, subtitle].compact.join(" : ") end |
#params ⇒ Object
20 21 22 |
# File 'app/models/homesteading/post.rb', line 20 def params { year: year, month: month, day: day, slug: slug } end |
#path ⇒ Object
15 16 17 18 |
# File 'app/models/homesteading/post.rb', line 15 def path post_type = Setting.where(name: "Post Type").first.content.downcase.pluralize "/" + [post_type, year.to_s.rjust(2, "0"), month.rjust(2, "0"), day.rjust(2, "0"), slug].compact.join("/") end |
#public? ⇒ Boolean
24 25 26 |
# File 'app/models/homesteading/post.rb', line 24 def public? !self.private? end |