<% @mplan.each do |day| %>
<% if day.saturday? || day.sunday? %>
" class="weekend">
| 考勤日期: |
" name="<%= day %>" type="date" value="<%= day%>" > |
考勤班组: |
<%= select_tag "shift#{day}" ,options_from_collection_for_select(@shifts,"id","shift"),:class => "text_input shift",:id =>"shift"+day.to_s %>
|
<% else %>
">
| 考勤日期: |
" name="<%= day %>" type="date" value="<%= day%>" > |
考勤班组: |
<%= select_tag "shift#{day}",options_from_collection_for_select(@shifts,"id","shift"),:class => "text_input shift",:id =>"shift"+day.to_s %>
|
<% end %>
<%end%>
关键代码 select_tag "shift#{day}" 其中day是循环的变量。