Date Ranges not working after DataMapper update

105 Views Asked by At
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.

0

There are 0 best solutions below