Awesome_nested_set:选择不工作的轨道

发布于 2024-10-08 12:40:57 字数 970 浏览 0 评论 0原文

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

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

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 destination_group_id value in the option that matches for the edit?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

知你几分 2024-10-15 12:40:57

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

我将值存储为整数,并且选择正在寻找字符串。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文