def start_of_this_week
today = Date.today
today - today.cwday + 1
end
def end_of_this_week
today = Date.today
start = today - today.cwday + 1
endday = start + 6
end
rr = ReportRecord.first(:pupil => pupil,
:report => report,
:created_at => start_of_this_week..end_of_this_week)
The code was working pretty well yesterday, but after an update it started failing saying:
TypeError at /dashboard can't iterate from DateTime
What can be the problem? I have tried that (start_of_this_week..end_of_this_week) is a range, so it should be ok with it.
Also ReportRecord model is using DataMapper.