Refactor .by_archive and .by_year.

This commit is contained in:
Pete Higgins 2012-02-10 00:48:32 -08:00
parent 94ae01ce6f
commit f140ed284f

View file

@ -63,12 +63,12 @@ module Refinery
end
class << self
def by_archive(archive_date)
where(['published_at between ? and ?', archive_date.beginning_of_month, archive_date.end_of_month])
def by_archive(date)
where(:published_at => date.beginning_of_month..date.end_of_month)
end
def by_year(archive_year)
where(['published_at between ? and ?', archive_year.beginning_of_year, archive_year.end_of_year])
def by_year(date)
where(:published_at => date.beginning_of_year..date.end_of_year)
end
def published_dates_older_than(date)