views:

21

answers:

1

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
%>
+2  A: 

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' }
    )
%>
Jordan
thanks for that I was toying with it for a while
Matt