lib/schnitzelpress/post.rb in schnitzelpress-0.1.1 vs lib/schnitzelpress/post.rb in schnitzelpress-0.2.0
- old
+ new
@@ -5,11 +5,11 @@
OEmbed::Providers.register_all
SoundCloudProvider = OEmbed::Provider.new("http://soundcloud.com/oembed", :json)
SoundCloudProvider << "http://*.soundcloud.com/*"
OEmbed::Providers.register(SoundCloudProvider)
-module SchnitzelPress
+module Schnitzelpress
class Post
include Mongoid::Document
include Mongoid::Timestamps
store_in :posts
@@ -168,15 +168,11 @@
def to_url
if home_page?
'/'
else
- published_at.present? ? "/#{year}/#{month}/#{day}/#{slug}/" : "/#{slug}/"
+ published_at.present? ? "/#{sprintf '%04d', year}/#{sprintf '%02d', month}/#{sprintf '%02d', day}/#{slug}/" : "/#{slug}/"
end
- end
-
- def to_etag
- Digest::MD5.hexdigest("-#{id}-#{updated_at}-")
end
def disqus?
disqus && published?
end