-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
For instance, I have the following class:
class Project
include Mongoid::Document MONGOID-5.0.0.rc.8
field :title
field :body
field :author
scope :who, lambda { | name| {:where => {:author => /\bname\b/i} }
scope :search, lambda { | query | {:any_of => [ { :title => /\b#
\b/i } ] } }
end
OK queries
Project.who('joe').count #=> integer
Project.search('Hi').count #=> integer
Project.search('Hi').who('joe').count #=> integer
Bad queries
Project.who('joe').search('Hi').count
=> ERROR in log:
BSON::InvalidObjectId: illegal ObjectId format
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bson-1.2.4/lib/bson/types/object_id.rb:122:in `from_string'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mongoid-2.0.0.rc.8/lib/mongoid/extensions/object_id/conversions.rb:69:in `convert
'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mongoid-2.0.0.rc.8/lib/mongoid/criterion/optional.rb:114:in `block in for_ids'
Any idea why this is? By the way, this is fine in 2.0.0.rc.7