mongoid/mongoid — Issue #1599: references_and_referenced_in_many fails to add items to its collection
Author: romanbsd
Created: 2012-01-15 22:39:12+00:00
State: open

Running this gist: https://gist.github.com/1617767 with 2.4.1 produces the following output:

group: group_1 has [#<Customer _id: 4f135411b4e4cfa3b8000002, _type: nil, name: "customer_1", business_id: BSON::ObjectId('4f135411b4e4cfa3b8000001')>]

group: group_1 has [#<Customer _id: 4f135411b4e4cfa3b8000003, _type: nil, name: "customer_2", business_id: BSON::ObjectId('4f135411b4e4cfa3b8000001')>]

group: group_2 has [#<Customer _id: 4f135411b4e4cfa3b8000004, _type: nil, name: "customer_3", business_id: BSON::ObjectId('4f135411b4e4cfa3b8000001')>]

group: group_2 has [#<Customer _id: 4f135411b4e4cfa3b8000004, _type: nil, name: "customer_3", business_id: BSON::ObjectId('4f135411b4e4cfa3b8000001')>, #<Customer _id: 4f135411b4e4cfa3b8000005, _type: nil, name: "customer_4", business_id: BSON::ObjectId('4f135411b4e4cfa3b8000001')>]

Customers count:
4
4
Group 1 size: 1
[#<Customer _id: 4f135411b4e4cfa3b8000003, _type: nil, name: "customer_2", business_id: BSON::ObjectId('4f135411b4e4cfa3b8000001')>]
Group 2 size: 2
[#<Customer _id: 4f135411b4e4cfa3b8000004, _type: nil, name: "customer_3", business_id: BSON::ObjectId('4f135411b4e4cfa3b8000001')>, #<Customer _id: 4f135411b4e4cfa3b8000005, _type: nil, name: "customer_4", business_id: BSON::ObjectId('4f135411b4e4cfa3b8000001')>]

The question is, where is customer_1 which was supposed to be in the first group?