Rails 3: f.select - options_for_select

后端 未结 6 1523
你的背包
你的背包 2021-01-31 16:47

I have a form on my Ruby on Rails3 Application with a drop menu, this is my current code for the select option:

<%= f.select :phone_type, options_for_select([         


        
6条回答
  •  我在风中等你
    2021-01-31 17:04

    This is a little cleaner:

    <%= f.select :phone_type, [ 'Cell', 'Work', 'Office', 'Home', 'Other' ], :prompt => 'Select One' %>
    

    The :prompt argument generates an option with an empty value.

提交回复
热议问题