How do I set a blank value for an f.select form field

前端 未结 5 1729
花落未央
花落未央 2021-02-01 12:24

I am using the following to allow my users to select their sex in their profile.

<%= f.select (:sex, %w{ Male Female }) %>

How would I c

5条回答
  •  礼貌的吻别
    2021-02-01 13:00

    in Rails 4 you can achieve prompt like this:

    <%= f.select :gender, %w{ Male Female }, {:prompt => "Gender..."} %>
    

    its working for me with simple form.

提交回复
热议问题