0

我有以下内容,但是在编辑记录时它不会显示当前值。需要改变什么来纠正这个

 <%= f.select :name, options_for_select([["Select Name", ""], "James", "John", "Richard", "Mike", "Peter"]), :class => 'small-input' %>

提前致谢

4

1 回答 1

1

只需使用:

= 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

于 2012-08-27T23:25:01.863 回答