我有一系列日期,我想按月分类
slots = [Fri, 19 Sep 2014 08:00:00 UTC +00:00, Fri, 19 Sep 2014 08:30:00 UTC +00:00, Fri, 19 Sep 2014 09:00:00 UTC +00:00, Fri, 19 Sep 2014 09:30:00 UTC +00:00]
<%= debug @labor_slots %>
- 2014-09-19 08:00:00.000000000 Z
- 2014-09-19 08:30:00.000000000 Z
- 2014-09-19 09:00:00.000000000 Z
- 2014-09-19 09:30:00.000000000 Z
- 2014-09-19 10:00:00.000000000 Z
- 2014-09-19 10:30:00.000000000 Z
- 2014-09-19 11:00:00.000000000 Z
- 2014-09-19 11:30:00.000000000 Z
- 2014-09-19 12:00:00.000000000 Z
- 2014-09-19 12:30:00.000000000 Z
我正在尝试从table_builder gem实现以下示例:
<%= calendar_for(@tasks) do |t| %>
<%= t.day do |day, tasks| %>
<% if tasks.nil? %>
<%= day.cweek %>
<% else %>
<%= day.day %>
<% tasks.each do |task| %>
<%= h(task.name) %>
<% end %>
<% end %>
<% end %>
<% end %>
gem的文档没有提供太多细节,是否可以修改此块以将其与我的插槽阵列一起使用?