Reputation:
This is the code that i'm using to render a drop down list in a form.
<label class= 'sniglet'> Nationality</label>
<%= f.select(:nationality_id, @nationalities.map {|n| [n.country_name, n.id]}, :class => 'form-control') %>
The default bootstrap style doesn't seem to be working. What could be the problem?
Upvotes: 0
Views: 90
Reputation: 1299
As per rails api, syntax for select form helper is
select(method, choices, options = {}, html_options = {})
You are passing class: 'form-control'
as third parameter, that's why it is not applying that class, you can check it using developer tools in browser. Pass it as fourth parameter.
e.g.
<%= f.select(:nationality_id, @nationalities.map {|n| [n.country_name, n.id]}, {}, class: 'form-control') %>
Upvotes: 6