开发者

awesome_nested_set :selected not working rails

开发者 https://www.devze.com 2023-01-31 08:41 出处:网络
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 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

精彩评论

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

关注公众号