-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
Pseudo Setup:
def AModel has_many :test_models end def TestModel belongs_to a_model scope :test_scope, where(:test_field.exists => false) end
Then when I call:
AModel.first.test_models.test_scope
I get:
#<Mongoid::Criteria selector: {"a_model_id"=>"1", "test_field"=>nil} options: {} class: TestModel embedded: false>
but the written out query is different (and correct)
AModel.first.test_models.where(:test_field.exists => false)
returns
#<Mongoid::Criteria selector: {"a_model_id"=>"1", "test_field"=>{"$exists"=>false}} options: {} class: TestModel embedded: false>
This only appears to be a problem when calling on a 'related' object.