Search code examples
ruby-on-railsdrop-down-menuform-helpers

How to add option value = "" in select boxed in Rails?


I want to use jQuery validation plugin for select boxes, but I don't know how to add value ="" in select. Here is my code:

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

I want to add

    value="" option="please select"

How I can do it in Rails ?


Solution

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