Created
October 6, 2012 20:54
-
-
Save scan/3846085 to your computer and use it in GitHub Desktop.
Get All By Week
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Model < ActiveRecord::Base | |
attr_accessible :date | |
def self.find_by_week(week, year) | |
dates = Date.commercial(year,week)..Date.commercial(year,week+1) | |
Model.where :date => dates.take(7) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment