mongoid/mongoid — Issue #1378: Switching from MongoMapper > Mongoid, getting undefined method `using_object_ids?'
Author: dmix
Created: 2011-10-26 17:14:10+00:00
State: open

I'm getting an error that I think might be related to the fact that the ID's in mongo are just integers, not BSON object_ids.

An example of the model in json: https://gist.github.com/1317032 (I'm querying company_id)

The line that generated the error:

@registers = Register.where(:company_id => current_user.company_id)

The error:

undefined method `using_object_ids?' for #

The framework trace:

activerecord (3.1.0) lib/active_record/base.rb:1082:in `method_missing'
mongoid (2.3.2) lib/mongoid/fields/serializable/foreign_keys/object.rb:21:in `object_id_field?'
mongoid (2.3.2) lib/mongoid/fields.rb:200:in `object_id_field?'
mongoid (2.3.2) lib/mongoid/extensions/object_id/conversions.rb:49:in `block (2 levels) in convert'
mongoid (2.3.2) lib/mongoid/extensions/object_id/conversions.rb:48:in `each_pair'
mongoid (2.3.2) lib/mongoid/extensions/object_id/conversions.rb:48:in `block in convert'
mongoid (2.3.2) lib/mongoid/extensions/object_id/conversions.rb:47:in `tap'
mongoid (2.3.2) lib/mongoid/extensions/object_id/conversions.rb:47:in `convert'
mongoid (2.3.2) lib/mongoid/criterion/inclusion.rb:216:in `block in where'

Using gems in a rails 3.1 app:
* bson_ext-1.4.1.gem
* mongo-1.4.1.gem
* mongoid-2.3.2.gem