Rails,选择帮手,添加样式

the*_*gah 14 ruby-on-rails

我正在尝试做这样的事情.

 select :model, :attribute, :style => "some:style;" 
Run Code Online (Sandbox Code Playgroud)

添加styleselect helper导轨中,但它无法正常工作.

Jim*_*dra 21

文件:

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

所以你的:style哈希需要成为第五个参数.例如:

select(:model, :attribute, @options_for_select, { }, { :style => 'some: style' }
Run Code Online (Sandbox Code Playgroud)