ドロップダウンメニューで事前に選択される値をActionView-Helpercollection_select
に取得させようとしています。
どちらでもない(:selected
html-option-hash内)
<%= 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}, {}) %>
うまくいくようです。
私は何が間違っているのですか?誰かがこれで私を助けることができますか?