嵌套集合可以有重复的子对象或多个parent_id/root/nodes吗?
嵌套集合可以有重复的子对象或多个parent_id/root/nodes吗?
例如,我想创建一个可以管理零件和设备的应用程序。然而,特定设备也可以具有与其他设备相同的部件。
关于最好的方法有什么想法吗?
谢谢你!!!
Can a nested set have duplicate child objects or multiple parent_id/root/nodes?
For instance, I want to create an application that can manage parts and equipment. However, a specific equipment can have the same parts from other equipment as well.
Any thoughts on the best approach for this?
Thank you!!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您这里需要的是一个关联类来帮助建模多对多关系。在 Rails 中,这可能看起来像这样:
还有其他对此进行建模的方法(例如使用树类型结构),但如果“集合”是您想要的,那么这就是我要走的方式。
完成此操作后,您可以执行以下操作:
I think what you need here is an association class to help model the many-to-many relationship. In rails, this might look something like this:
There are other ways of modelling this (e.g. using a tree type structure), but if a 'set' is what you want, then this is the way I'd go.
Once this is done, you can do things like: