我在我的rails应用程序中使用twitter-bootstrap。
<%= f.select :rating, options_for_select([["Good","1"],["Average","2"],["Poor","3"]]), :class => "form-control" %>
但是form-control
类在选择字段
请帮助我让风格发挥作用。
感谢。
答案 0 :(得分:3)
如果你look at the docs,class
键是最后一个参数的一部分,这是一个哈希。在那之前有一个选项哈希:
f.select :rating, options_for_select([["Good","1"],["Average","2"],["Poor","3"]]), {}, class: "form-control"
以下是使用选项哈希的示例:
f.select :rating, options_for_select(...), { include_blank: "Choose" }, class: "foo"