Using Rails 4. Can't seem to add class
to select
. I think other attributes like required
, autofocus
are also not there:
<%= form.select "availability", options_for_select(1..200), required: 'true', autofocus: 'true', class: 'form-control' %>
Output is below:
<select id="event_availability" name="event[availability]"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> ... </select>
Any idea? Thanks.
Try this
<%= form.select "availability", options_for_select(1..200), {}, {required: 'true', autofocus: 'true', class: 'form-control'} %>
Possible options for third argument are :prompt
and :include_blank
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With