awesome_nested_set:选择不工作的轨道

时间:2010-12-17 22:21:30

标签: ruby-on-rails html-select

我已经尝试了所有我能想到的方法,但它们似乎都没有起作用:

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值?

1 个答案:

答案 0 :(得分:0)

我会删除这个,因为我现在觉得很愚蠢,但我会把它留给遇到同样问题的任何人。

我将值存储为整数,而select正在查找字符串。