如何使用collection_select使用bootstrap下拉列表。这是我的代码
<%= collection_select(:item, :PriorityId, Priority.all, :PriorityId, :Priority, {:include_blank => true}, {:class => 'dropdown-menu'}) %>
但我希望它是一个引导下拉菜单,而不是简单的html选择
答案 0 :(得分:2)
将form-control
类添加到您的代码中:
<%= collection_select(:item, :PriorityId, Priority.all, :PriorityId, :Priority, {:include_blank => true}, {:class => 'form-control'}) %>
form-control
适用于Bootstrap 3和4。