如何在Rails中选择框中添加选项值=“”?

时间:2012-10-04 07:45:15

标签: ruby-on-rails drop-down-menu form-helpers

我想为选择框使用jQuery验证插件,但我不知道如何在select中添加value =“”。这是我的代码:

   <%= f.select :language, options_for_select([
       "--- please select ---",
        "Arabic",
        "Chinese"
         ])
        %>

我想添加

    value="" option="please select"

我如何在Rails中完成它?

1 个答案:

答案 0 :(得分:1)

<%= f.select :language, options_for_select([
    "Arabic",
    "Chinese"
     ], {:prompt => "please select"})
    %>