2013-10-22 13 views
0

我用下面的代碼獲取錯誤集合中選擇,不能使用默認值,它

<%= f.collection_select :location_id, Location.all, :id, {:selected => session["location"]},:formatted_display, { prompt: true }, :required => true, :class => 'chosen-select order_form' %> 

我收到以下錯誤,當我嘗試上述默認值:

wrong number of arguments (7 for 4..6) 

回答

1

嘗試用這種

<%= f.collection_select :location_id, Location.all, :id, :name,{ :prompt => true , :selected => session["location"]}, :class => 'chosen-select order_form'%> 
+0

我已經得到了同樣的錯誤數量的參數錯誤 – Aravind

+0

的它的工作原理與此編輯 '<%= f.collection_select:location_id,Location.all,:id,:name,{:prompt => true,:selected => session [「location」]},:class =>'chosen-select order_form 「%>' – Aravind