Details
-
Bug
-
Resolution: Fixed
-
Major - P3
-
7.0.1
-
None
-
Ruby 2.5.1
Description
++Setting an embeds_one to nil does not persist.
For example:
Mongoid::VERSION # => "7.0.1" |
|
class A |
include Mongoid::Document
|
embeds_one :b
|
end
|
|
class B |
include Mongoid::Document
|
embedded_in :a
|
field :memo, type: String
|
end
|
|
a = A.create(b: { memo: 'before' }) |
a.b.memo # => "before" |
|
a.b = nil
|
a.b # => nil
|
|
a.save
|
a.reload
|
|
# I expect it to be nil
|
a.b # => #<B _id: 5b33301f13909416dbc0d480, memo: "before"> |
It works well in version 6.2.1.
In version 7.0.1 it works well when calling destroy method.
Thanks
Attachments
Issue Links
- is depended on by
-
MONGOID-4600 Release Mongoid 7.0.2
-
- Closed
-