我正在使用select标签创建一个选项框
用于创建选项框我已编写以下代码
= f.select :user_id_eq,
[raw("<option value=''>All Open Projects</option><option value='#{current_user.id}' selected='selected'>My Open Projects</option><optgroup label='Open Projects by Creator'>")] + current_user.company.projects.includes(:user).find(:all, :select => "DISTINCT user_id").collect {|p| [ p.user.name, p.user_id ] },
{}, :'data-remote' => true, class: 'searchSelect'
但是这会在html内容中创建一个额外的空白字段
<option value=''>All Open Projects</option><option value='7' selected='selected'>My Open Projects</option><optgroup label='Open Projects by Creator'>"
<option value="">All Open Projects</option>
<option value="7" selected="selected">My Open Projects</option>
<optgroup label="Open Projects by Creator">
<option value="2">Cas Elliott</option>
<option value="6">Rakl</option>
<option value="5">Jas</option></optgroup>
第一行是正在创建的额外行。 为什么这条线创造了任何想法??? 提前致谢