Skip to content

Commit 0f23b7c

Browse files
p-mongop
andauthored
Tweak some callbacks documentation for grammar (#5325)
Co-authored-by: Oleg Pudeyev <[email protected]>
1 parent 2d865a7 commit 0f23b7c

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

source/reference/callbacks.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ Mongoid supports the following callbacks for :doc:`documents </tutorials/documen
3737
- ``after_destroy``
3838

3939
Callbacks are available on any document, whether it is embedded within
40-
another document or not. Note that to be efficient, Mongoid only fires
41-
the callback of the document that the persistence action was executed on.
42-
This is that Mongoid aims to support large hierarchies and to handle
43-
optimized atomic updates callbacks can't be firing all over the document
44-
hierarchy.
40+
another document or not. Note that to be efficient, Mongoid only invokes
41+
the callback on the document that the persistence action was executed on.
42+
This enables Mongoid to support large hierarchies and to handle optimized
43+
atomic updates efficiently (without invoking callbacks throughout the document
44+
hierarchy).
4545

4646
Note that using callbacks for domain logic is a bad design practice, and can
4747
lead to unexpected errors that are hard to debug when callbacks in
@@ -82,20 +82,20 @@ syntax as well:
8282
end
8383
end
8484

85+
8586
Association Callbacks
8687
=====================
8788

88-
Mongoid has a set of callbacks that are specific to collection based
89-
associations - these are:
89+
Mongoid has a set of callbacks that are specific to associations - these are:
9090

9191
- ``after_add``
9292
- ``after_remove``
9393
- ``before_add``
9494
- ``before_remove``
9595

96-
Each time a document is added or removed from any of the following associations,
97-
the respective callbacks are invoked: ``embeds_many``,
98-
``has_many``, and ``has_and_belongs_to_many``.
96+
Each time a document is added or removed from any of the following
97+
associations, the respective callbacks are invoked: ``embeds_many``,
98+
``has_many`` and ``has_and_belongs_to_many``.
9999

100100
Association callbacks are specified as options on the respective association.
101101
The document added/removed will be passed as the parameter to the specified

0 commit comments

Comments
 (0)