所以我正在經歷我當collection_select連接到我的form_for對象,像這樣的錯誤:導軌 - 綁定與不綁定的軌道集合中選擇
<%= f.collection_select(:city_id, @cities, :id, :name, {:prompt => "Select a City"}, {:id => 'cities_select', multiple: true}) %>
,並得到錯誤:
undefined local variable 'city_id'
但是,當我不綁定選擇像這樣:
<%= collection_select(nil, :city_id, @cities, :id, :name, {:prompt => "Select a City"}, {:id => 'cities_select', multiple: true}) %>
它工作正常。
我只想理解爲什麼一個人工作而另一個人不工作的理論?
謝謝,我會看看文檔! – Zephyr4434 2013-05-09 02:20:14