Reputation: 267
I want to format form fields with Boostrap CSS.
I have following code in form view file:
<p>
<%= f.label :country %>
<%= f.select :country, ["India","USA","Australia"] %>
</p>
I want it to format as:
<select class="form-control">
<option>India</option>
<option>USA</option>
<option>Australia</option>
</select>
I have tried few different ways that I thought would work, but no success.
Upvotes: 0
Views: 29
Reputation: 17802
<%= f.select :country, options_for_select(["India", "USA", "Australia"]), class: "form-control" %>
It will generate the desired output.
Upvotes: 1