-
Type: Bug
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Affects Version/s: 7.0.2
-
Component/s: Associations
Say I have three classes set up with has_many associations that form a chain:
class C include Mongoid::Document belongs_to :b, optional: true end class B include Mongoid::Document has_many :cs, class_name: "C", inverse_of: :b, dependent: :nullify belongs_to :a, optional: true end class A include Mongoid::Document has_many :bs, class_name: "B", inverse_of: :a, dependent: :destroy end
When I now create a chain of objects:
a = A.create b = a.bs.create c = b.cs.create
And clear the bs in a, I'd expect c's b_id to be nullified, however:
a.bs.clear # => {} b.reload # throws an exception as expected c.reload c.b_id # => BSON::ObjectId('5c5f0e6d77b4b61dc25376c8')
- is related to
-
MONGOID-4708 Default dependent behavior is no-op rather than nullify as documented
- Closed