I need to set an HTML class to this rails select and i have tried many variations and nothing
<%= add.select :state,
@states.map { |s| [ s.name, s.abbr ] },
:class => 'state',
:include_blank => true
%>
I need to set an HTML class to this rails select and i have tried many variations and nothing
<%= add.select :state,
@states.map { |s| [ s.name, s.abbr ] },
:class => 'state',
:include_blank => true
%>
I believe your html_options
should go after your options
. Also, since you're specifying two hashes for your last two arguments, you should use curly braces to explicitly tell Ruby that they're two separate hashes. Try this:
<%= add.select(:state,
@states.map { |s| [ s.name, s.abbr ] },
{ :include_blank => true },
{ :class => 'state' }
)
%>