Right now I have a dropdown which is coded like so:
<%= f.select(:mydropdown, [["None", "0"], ["Some", "1"], ["More", "2"]], { :include_blank => true })%>
Is there a way to specify that each of these options should also have an associated class? So that it would output…
<option value="0" class="none">None</option>
This is so that I can color code various options. I can use CSS3 for that, but would like to have something more widely supported if possible.
Just do this:
Ref here:
http://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html#method-i-options_for_select