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)
昨天代码工作得很好,但是在更新后它开始没有说:
/ dashboard上的TypeError 无法从DateTime迭代
可能是什么问题? 我试过(start_of_this_week..end_of_this_week)是一个范围,所以应该没问题。
ReportRecord模型也在使用DataMapper。