在这里添加类标签有困难:
<div class="field">
<%= label_tag(:school_or_org, "Are you a school or a non-profit organization?") %>
<%= select_tag(:school_or_org, options_for_select([ ['school', "school"], ['non-profit', "non-profit"] ])) %>
</div>
以下是我尝试过的方法:
<div class="field">
<%= label_tag(:school_or_org, "Are you a school or a non-profit organization?") %>
<%= select_tag(:school_or_org, options_for_select([ ['school', "school"], ['non-profit', "non-profit"], {:class => 'form-control'} ])) %>
</div>
当我通过firebug检查时,我没有看到类信息,所以显然它没有被添加。
我该如何添加它才能在表单中显示出来?
谢谢。
编辑一
你是指像这样吗:
<%= select_tag(:school_or_org, options_for_select([ ['school', "school"], ['non-profit', "non-profit"]] ), {:class => 'form-control'}) %>
它没有起作用。
仅供参考,这就是我想让选择框看起来像的地方:http://getbootstrap.com/css/#forms(查看选择部分)。那是我从中获取 "form-control" 的地方。