Skip to content

Commit eb788c6

Browse files
authored
MONGOID-5016 default embedded touch to true (#5554)
* first steps toward a `touch: true` default for embedded_in relations * add touch suppression so that `touch: false` can override `touch: true` * typo * refactor the deeply nested callbacks to another method * update release notes
1 parent b161d34 commit eb788c6

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

source/release-notes/mongoid-9.0.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,24 @@ persistence operation per parent document, even when using multiple
191191
levels of nested embedded documents.
192192

193193

194+
``embedded_in`` associations now default to ``touch: true``
195+
-----------------------------------------------------------
196+
197+
Updating an embedded subdocument will now automatically touch the parent,
198+
unless you explicitly set ``touch: false`` on the relation:
199+
200+
.. code-block:: ruby
201+
202+
class Address
203+
include Mongoid::Document
204+
include Mongoid::Timestamps
205+
206+
embedded_in :mall, touch: false
207+
end
208+
209+
For all other associations, the default remains ``touch: false``.
210+
211+
194212
Flipped default for ``:replace`` option in ``#upsert``
195213
------------------------------------------------------
196214

0 commit comments

Comments
 (0)