Sam 山
Sam 山

Reputation: 42863

Rails, select helper, adding style

I'm trying to do something like this.

 select :model, :attribute, :style => "some:style;" 

Add style to the select helper in rails, but it is not working.

Upvotes: 17

Views: 19310

Answers (1)

Jimmy
Jimmy

Reputation: 37151

From the documenation:

select(object, method, choices, options = {}, html_options = {})

So your :style hash needs to be the 5th parameter. For example:

select(:model, :attribute, @options_for_select, { }, { :style => 'some: style' }

Upvotes: 24

Related Questions