Rails collection_select + bootstrap下拉列表

时间:2015-12-03 00:18:50

标签: css twitter-bootstrap ruby-on-rails-4

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

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

1 个答案:

答案 0 :(得分: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(object,method,collection,value_method,text_method,options = {},html_options = {})