Rails,选择帮手,添加样式

时间:2010-02-20 10:52:59

标签: ruby-on-rails

我正在尝试这样做。

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

style添加到rails中的select helper,但它无效。

1 个答案:

答案 0 :(得分:21)

来自documenation

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

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

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