lib/mongoid/publish.rb in publish-0.0.5 vs lib/mongoid/publish.rb in publish-0.0.6

- old
+ new

@@ -10,32 +10,27 @@ scope :published_and_orderly, where(:published => true, :published_at.lte => Date.today).desc(:published_at, :created_at) before_save :set_published_at end - module InstanceMethods - def published? - if self.published && self.published_at && self.published_at <= Date.today - true - else - false - end - end + def published? + return true if self.published && self.published_at && self.published_at <= Date.today + false + end - def publish! - self.published = true - self.published_at = Date.today - self.save - end - - def publication_status - self.published? ? self.published_at : "draft" - end + def publish! + self.published = true + self.published_at = Date.today + self.save + end + + def publication_status + self.published? ? self.published_at : "draft" + end - private - def set_published_at - self.published_at = Date.today if self.published && self.published_at.nil? - end + private + def set_published_at + self.published_at = Date.today if self.published && self.published_at.nil? end module ClassMethods end \ No newline at end of file