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

前端 未结 5 1727
花落未央
花落未央 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 12:54

    I think you can do something like this:

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

提交回复
热议问题