【发布时间】:2018-06-02 07:39:49
【问题描述】:
我正在考虑使用 Ice Cube https://github.com/seejohnrun/ice_cube 来处理重复性事件。 我的问题是,如果我需要在给定时间段内(例如,一天或一周内)获取任何事件,有没有比像这样循环遍历它们更好的方法:
items = Records.find(:all)
items.each do |item|
schedule = item.schedule
if schedule.occurs_on?(Date.new)
#if today is a recurrence, add to array
end
end
这似乎非常低效,但我不知道该怎么做。
【问题讨论】:
-
你最终做了什么?我被困在同一个地方?谢谢
标签: ruby-on-rails ruby-on-rails-3 ice-cube