0
標題可能不準確,但如何在下拉菜單的循環中增加日期?在下拉菜單中增加7天
控制器(簡單):
f = Foo.find(1)
f.start_date = Date.today
f.end_date = 30.days.from_now
f.save
@arr = *(f.start_date..f.end_date)
查看:
<select class="ui dropdown">
<option value="">Select work week</option>
<% @arr.each do |a| %>
<option value="<%= a %>"><%= a %> to <%= (a + 7.days) %></option>
<% end %>
</select>
從下拉菜單中預計:
(today) to (7th day)
(8th day) to (15th day)
...
...
(last day)
如何去這個問題?