How to scope last week by Date object [duplicate]
This should do the trick:
scope :last_week, lambda { where("purchase_date >= :date", :date => 1.week.ago) } scope :past_week, lambda { where("purchase_date >= :start_date AND purchase_date <= :end_date", {:start_date => 1.week.ago, :end_date => 1.day.ago }) }