lib/schnitzelpress/post.rb in schnitzelpress-0.0.13 vs lib/schnitzelpress/post.rb in schnitzelpress-0.1.0
- old
+ new
@@ -56,11 +56,11 @@
before_validation :set_defaults
validate :validate_slug
before_save :update_body_html
def disqus_identifier
- slug
+ "post-#{id}"
end
def slug
slugs.try(:last)
end
@@ -159,11 +159,19 @@
def day
published_at.day
end
+ def home_page?
+ slug == 'home'
+ end
+
def to_url
- published_at.present? ? "/#{year}/#{month}/#{day}/#{slug}/" : "/#{slug}/"
+ if home_page?
+ '/'
+ else
+ published_at.present? ? "/#{year}/#{month}/#{day}/#{slug}/" : "/#{slug}/"
+ end
end
def disqus?
disqus && published?
end