Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails collection_select + bootstrap dropdown

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

I have a form and then I'm using fields_for as shown above to collect input. But I'm unable to see the stylized bootstrap dropdown as illustrated here. What changes should I be making to see the bootstrap stylized dropdown?

like image 477
Aiyoyo Avatar asked Feb 07 '26 10:02

Aiyoyo


1 Answers

from

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

to

<%= 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 = {})

like image 79
richfisher Avatar answered Feb 09 '26 08:02

richfisher



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!