2015-12-03 141 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 = {})