使用 Mongoid 在 Rails 3 中查找不关联的记录?
我的问题类似于这个,除了我试图在 Mongoid 中执行此操作。
我有两个模型:
class ImageUpload
include Mongoid::Document
referenced_in :post
end
class Post
include Mongoid::Document
references_many :image_uploads
end
如何选择与任何帖子无关的图片上传?
My question is similar to this one, except I'm trying to do this in Mongoid.
I have two models:
class ImageUpload
include Mongoid::Document
referenced_in :post
end
class Post
include Mongoid::Document
references_many :image_uploads
end
How can I select the image uploads that are not associated with any post?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否尝试过以下操作:
Have you tried following: