2015-12-03 96 views
2
<div class="dropdown"> 
... 
<%= ff.collection_select :vendor_id, @vendors, :id, :vendor, :include_blank => true, class: "dropdown-menu" %> 
... 
</div> 

我有一个表格,然后我使用fields_for如上所示收集输入。但我无法看到here所示的程式化引导程序下拉列表。我应该做些什么改变才能看到bootstrap风格化的下拉菜单?Rails的collection_select +引导下拉列表

回答

4

<%= ff.collection_select :vendor_id, @vendors, :id, :vendor, :include_blank => true, class: "dropdown-menu" %> 

<%= ff.collection_select :vendor_id, @vendors, :id, :vendor, {:include_blank => true}, {class: "dropdown-menu"} %> 

collection_select(对象,方法,收集,value_method,text_method,选项= {},html_options = {})