Scoping date attribute for this week?
I am trying to scope all of my Products for this week, so it should show all the products leading up to whichever day of the week.

    class Product < ActiveRecord::Base
       attr_accessible :purchase_date
    
       def self.this_weeks
        where("purchase_date >= ?", Date.at_beginning_of_week - Date.at_end_of_week)
      end
    
      create_table :products do |t|
          t.date :purchase_date
      end
    end

This gives me an error though:

    undefined method `at_beginning_of_week'

What do I need to correct?


Scoping date attribute for this week?
===

I am trying to scope all of my Products for this week, so it should show all the products leading up to whichever day of the week.

    class Product < ActiveRecord::Base
       attr_accessible :purchase_date
    
       def self.this_weeks
        where("purchase_date >= ?", Date.at_beginning_of_week - Date.at_end_of_week)
      end
    
      create_table :products do |t|
          t.date :purchase_date
      end
    end

This gives me an error though:

    undefined method `at_beginning_of_week'

What do I need to correct?

