-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
Using Mongoid 3.1.0-stable (latest Github commit as of 2013-07-03, ref: 13f6a2dad15998206e30dc3ca6101b640c6ecd48)
class Customer include Mongoid::Document belongs_to :sales_rep, class_name: 'User' end
This works
c = Customer.first c.sales_rep = User.first._id # OK c.sales_rep = nil c.sales_rep = User.first._id # OK
This throws error
c = Customer.first # first time c.sales_rep = User.first._id # OK # second time c.sales_rep = User.first._id #=> error undefined method `_id' for "51a36b546f2958eef0000053":Moped::BSON::ObjectId # third time c.sales_rep = User.first._id # OK (strangely, running same method again works)