Bootstrap和collection_select

时间:2017-01-11 19:10:02

标签: ruby-on-rails twitter-bootstrap

如何使用collection_select使用bootstrap下拉列表。这是我的代码

<%= collection_select(:item, :PriorityId, Priority.all, :PriorityId, :Priority, {:include_blank => true}, {:class => 'dropdown-menu'}) %>

但我希望它是一个引导下拉菜单,而不是简单的html选择

1 个答案:

答案 0 :(得分:2)

form-control类添加到您的代码中:

<%= collection_select(:item, :PriorityId, Priority.all, :PriorityId, :Priority, {:include_blank => true}, {:class => 'form-control'}) %>

form-control适用于Bootstrap 34