views:

89

answers:

1

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

I'm trying to do something like this.

Add style to the select helper in rails

A: 

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' }
Jimmy Cuadra
what things can I style.
Sam
Anything you want. That last parameter just creates HTML attributes on the select element, so a hash like this:`{ :class => 'myclass', :style => 'display: inline;' }`would create:`<select class="myclass" style="display: inline;">...</select>`
Jimmy Cuadra