这可能很容易,但我很难弄清楚。
我有一个部分:
<% for room in @scrape %>
<tr id="page_<%= room.id %>">
<th scope="row" class="<%= cycle("spec", "specalt") -%>"><%=h room.name %></td>
<td class="<%=current_cycle%>"><%=h room.day1 %></td>
<td class="<%=current_cycle%>"><%=h room.day2 %></td>
<td class="<%=current_cycle%>"><%=h room.day3 %></td>
<td class="<%=current_cycle%>"><%=h room.day4 %></td>
<td class="<%=current_cycle%>"><%=h room.day5 %></td>
<td class="<%=current_cycle%>"><%=h room.day6 %></td>
<td class="<%=current_cycle%>"><%=h room.day7 %></td>
<td class="<%=current_cycle%>"><%= select_tag("room[#{room.id}]", options_for_select(0..room.spots,0)) %></td>
</tr>
<% end %>
从 find_by_sql 结果如下:
ID Room Day1 Day2 Day3 Day4 Day5 Day6 Day7
18298 Blue Room 13.23 13.23 13.23 13.23 13.23 13.23 13.23
但我不知道会有多少天,我怎样才能循环遍历不同天的列结果?