Class: Homesteading::Post

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/homesteading/post.rb

Instance Method Summary collapse

Instance Method Details

#nameObject



28
29
30
# File 'app/models/homesteading/post.rb', line 28

def name
  [title, subtitle].compact.join(" : ")
end

#paramsObject



20
21
22
# File 'app/models/homesteading/post.rb', line 20

def params
  { year: year, month: month, day: day, slug: slug }
end

#pathObject



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

Returns:

  • (Boolean)


24
25
26
# File 'app/models/homesteading/post.rb', line 24

def public?
  !self.private?
end