我有以下内容,但是在编辑记录时它不会显示当前值。需要改变什么来纠正这个
<%= f.select :name, options_for_select([["Select Name", ""], "James", "John", "Richard", "Mike", "Peter"]), :class => 'small-input' %>
提前致谢
我有以下内容,但是在编辑记录时它不会显示当前值。需要改变什么来纠正这个
<%= f.select :name, options_for_select([["Select Name", ""], "James", "John", "Richard", "Mike", "Peter"]), :class => 'small-input' %>
提前致谢
只需使用:
= f.select :your_field, options_for_select(array_list_of_possibilities, selected_value), :prompt => "select a name : "
看看: http ://apidock.com/rails/v3.2.8/ActionView/Helpers/FormOptionsHelper/select