1

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?

Community
  • 1
  • 1
picardo
  • 24,530
  • 33
  • 104
  • 151

1 Answers1

0

Have you tried following:

ImageUpload.where(:post_id => nil)
rubish
  • 10,887
  • 3
  • 43
  • 57