2010-12-17 68 views
0

我已經嘗試了所有這一切我能想到的辦法,但他們都不是工作:awesome_nested_set:選擇不工作軌道

f.select :destination_group_id, options_for_select(nested_set_options(DestinationGroup) {|i| "#{'-' * i.level} #{i.name}" }, :selected => @purchase.destination_group_id) 
select_tag 'purchases[destination_group_id]', options_for_select(nested_set_options(DestinationGroup) {|i| "#{'-' * i.level} #{i.name}" }, :selected => @purchase.destination_group_id) 
f.select :destination_group_id, options_for_select(nested_set_options(DestinationGroup) {|i| "#{'-' * i.level} #{i.name}" }, :selected => @purchase) 
f.select :destination_group_id, options_for_select(nested_set_options(DestinationGroup) {|i| "#{'-' * i.level} #{i.name}" }), :selected => @purchase.destination_group_id 
f.select :destination_group_id, nested_set_options(DestinationGroup) {|i| "#{'-' * i.level} #{i.name}" }), :selected => @purchase.destination_group_id 

和幾乎所有其他的方式,我能想到的

如何讓它在與編輯相匹配的選項中選擇destination_group_id值?

回答

0

我會刪除這個,因爲我現在覺得很蠢,但是我會把它留給任何遇到同樣問題的人。

我把值存儲爲整數,而select正在尋找一個字符串。