File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -1396,19 +1396,21 @@ Mongoid to instantiate a new document when the association is accessed and it is
1396
1396
1397
1397
Touching
1398
1398
--------
1399
-
1400
1399
Any ``belongs_to`` association can take an optional ``:touch`` option which
1401
- will cause the parent document be touched whenever the child document is
1402
- touched :
1400
+ will cause the parent document to be touched whenever the child document is
1401
+ updated :
1403
1402
1404
1403
.. code-block:: ruby
1405
1404
1406
1405
class Band
1407
1406
include Mongoid::Document
1407
+ field :name
1408
1408
belongs_to :label, touch: true
1409
1409
end
1410
1410
1411
1411
band = Band.first
1412
+ band.name = "The Rolling Stones"
1413
+ band.save! # Calls touch on the parent label.
1412
1414
band.touch # Calls touch on the parent label.
1413
1415
1414
1416
``:touch`` can also take a string or symbol argument specifying a field to
You can’t perform that action at this time.
0 commit comments