Skip to content

Commit

Permalink
Use range to produce "BETWEEN" query.
Browse files Browse the repository at this point in the history
  • Loading branch information
ugisozols committed Jun 21, 2012
1 parent 70acd0b commit 5f75bd1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/refinery/news/item.rb
Expand Up @@ -34,11 +34,11 @@ def prev

class << self
def by_archive(archive_date)
where(['publish_date between ? and ?', archive_date.beginning_of_month, archive_date.end_of_month])
where(:publish_date => archive_date.beginning_of_month..archive_date.end_of_month)
end

def by_year(archive_year)
where(['publish_date between ? and ?', archive_year.beginning_of_year, archive_year.end_of_year])
where(:publish_date => archive_year.beginning_of_year..archive_year.end_of_year)
end

def all_previous
Expand Down

0 comments on commit 5f75bd1

Please sign in to comment.