【发布时间】:2010-11-04 08:47:51
【问题描述】:
我正在尝试让ActionView-Helper collection_select 获取将在下拉菜单中预先选择的值。
两者都不是(html-option-hash 中的:selected)
<%= collection_select(:my_object, :my_method, @my_collection, :id, :description_string, {}, {:selected => @my_collection_object.id}) %>
也不(:selected 在选项哈希中)
<%= collection_select(:my_object, :my_method, @my_collection, :id, :description_string, {:selected => @my_collection_object.id}, {}) %>
似乎有效。
我做错了什么?谁能帮我解决这个问题?
【问题讨论】:
标签: ruby-on-rails actionview actionviewhelper