Skip to content

Commit c0eda4b

Browse files
committed
MR PR fixes 2
1 parent 6a11623 commit c0eda4b

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

source/interact-data/transaction.txt

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,17 @@ following tasks:
7272

7373
#. Performs the specified data changes.
7474

75-
#. Commits the transaction if no errors occur or ends the transaction if
76-
there is an error.
75+
#. Commits the transaction to the database if no errors occur, or ends
76+
the transaction if there is an error.
7777

7878
#. Closes the session.
7979

8080
If your transaction is committed, {+odm+} calls any ``after_commit``
8181
callbacks for all objects modified inside the transaction. If there is
8282
an error and the transaction is rolled back, {+odm+} calls any
8383
``after_rollback`` callbacks for all objects modified inside the
84-
transaction. To learn more about this behavior, see the
85-
:ref:`mongoid-txn-callbacks` section of this guide.
84+
transaction. To learn more about these callbacks and their behavior, see
85+
the :ref:`mongoid-txn-callbacks` section of this guide.
8686

8787
Example
8888
~~~~~~~
@@ -133,10 +133,10 @@ Ending Transactions
133133
Any exception raised inside the transaction method block ends the
134134
transaction and rolls back data changes. {+odm+} displays all
135135
exceptions except for the ``Mongoid::Errors::Rollback`` exception. You
136-
must raise this exception in your application to explicitly end the
137-
transaction without returning the exception to you. You might implement
138-
this transaction exception to end a transaction when a certain condition
139-
is not met without raising an exception message.
136+
can raise this exception in your application to explicitly end the
137+
transaction without returning the exception to you. For example, you
138+
might implement this transaction exception to end a transaction when a
139+
certain condition is not met, but without raising an exception message.
140140

141141
.. _mongoid-txn-callbacks:
142142

@@ -164,9 +164,9 @@ might occur, for example, if {+odm+} raised an exception in the
164164
to trigger ``after_commit``.
165165

166166
The ``after_rollback`` callback is triggered for an object that was
167-
created, saved, or deleted inside a transaction if the transaction was
168-
ended. {+odm+} never triggers ``after_rollback`` outside of a
169-
transaction.
167+
created, saved, or deleted inside a transaction, if the transaction was
168+
unsuccessful and changes were rolled back. {+odm+} never triggers
169+
``after_rollback`` outside of a transaction.
170170

171171
.. TODO link to callbacks guide.
172172

@@ -287,8 +287,8 @@ You can use the ``with_session()`` method on a model class and pass it session
287287
options to perform a block of operations in the context of a session.
288288

289289
The following code enables the ``causal_consistency`` option to
290-
guarantee the order of operations when creating a session, then
291-
performs data operations:
290+
guarantee the order of operations when creating a session on the
291+
``Book`` model, then performs data operations:
292292

293293
.. literalinclude:: /includes/interact-data/transaction.rb
294294
:start-after: start-model-session
@@ -301,13 +301,13 @@ To learn more about the available session options, see the
301301
<{+ruby-api+}/Session.html#initialize-instance_method>`__ in the
302302
{+ruby-driver+} API documentation.
303303

304-
Alternatively, you can use the ``with_session()`` on an instance of a
304+
Alternatively, you can use the ``with_session()`` method on an instance of a
305305
model and pass it session options to perform a block of operations in
306306
the context of a session.
307307

308308
The following code enables the ``causal_consistency`` option to
309-
guarantee the order of operations when creating a session, then
310-
performs data operations:
309+
guarantee the order of operations when creating a session on an instance
310+
of ``Book``, then performs data operations:
311311

312312
.. literalinclude:: /includes/interact-data/transaction.rb
313313
:start-after: start-instance-session

0 commit comments

Comments
 (0)