更改 mongoid 关系的名称 (embeds_...,belongs_to,has_...)
当您有诸如 embeds_many :album_items
之类与 AlbumItem
模型相关的关系时。我怎样才能将它存储在 items
中。我尝试了 embeds_many :album_items, :as => :items 和 embeds_many :items, :class_name =>专辑项目
。两者都不起作用。
我该如何重命名该关系?
谢谢
When you have a relation such as embeds_many :album_items
which relates to the AlbumItem
model. How can I have it stored in just items
. I tried embeds_many :album_items, :as => :items
and embeds_many :items, :class_name => AlbumItem
. Neither worked.
How can I go about renaming the relation?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这有效吗(假设您的父模型名称是
Album
)?在专辑中:
和在专辑项中:
Does this work(assuming your parent model name is
Album
)?In Album:
and in AlbumItem: