我的 Rails 视图 (index.html.erb) 中有多个下拉框。代码如下所示:
......
......
<td>
<% @builds.each_with_index do |row,index|
if row2[0].to_s == row_s[0] %>
(When this condition is true I want to set the value of the dropdown list)
(The value could be PASS, FAIL or PENDING which comes from the database as row_s[7])
<form id=<%= "build_status_form#{index}" %>>
<select name="condition"
id=<%= "build_status#{index}" %> onchange="this.form.submit()">
<option value="PENDING">PENDING</option>
<option value="PASS">PASS</option>
<option value="FAIL">FAIL</option>
</select>
</form>
<% end %>
<% end %>
</td>
如何动态设置每个下拉列表的默认值?