Rails,选择帮手,添加样式

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

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

在rails中为select helper添加style ,但它不起作用。

从文件 :

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

所以你的:style hash需要成为第五个参数。 例如:

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