开发者

awesome_nested_set :selected not working rails

I have tried this all the ways I can think of, but none of them seem to be working:

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

and pretty much every other way I can think of

How do I get it to select the des开发者_运维问答tination_group_id value in the option that matches for the edit?


I would delete this because I feel stupid now, but I will leave it for anyone that comes across it with the same problem.

I had the values stored as integers, and the select was looking for a string.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜