1
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.

Felix
  • 4,510
  • 2
  • 31
  • 46
gkaykck
  • 2,347
  • 10
  • 35
  • 52
  • actually there is nothing about iteration, yet i think https://github.com/rails/rails/pull/11474 this is releated. – gkaykck Dec 17 '13 at 18:32

0 Answers0