Skip to content

Commit

Permalink
Improve while_preventing_writes documentation
Browse files Browse the repository at this point in the history
Adds a note to clarify that `while_preventing_writes` is not meant to be
a replacement for a readonly replica user.

Closes #39132 and #39133

Co-authored-by: Eike Send <eike.send@gmail.com>
  • Loading branch information
eileencodes and eikes committed Sep 21, 2020
1 parent 33b70ca commit bba75d1
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1035,6 +1035,12 @@ def prevent_writes=(prevent_writes) # :nodoc:
# In some cases you may want to prevent writes to the database
# even if you are on a database that can write. `while_preventing_writes`
# will prevent writes to the database for the duration of the block.
#
# This method does not provide the same protection as a readonly
# user and is meant to be a safeguard against accidental writes.
#
# See `READ_QUERY` for the queries that are blocked by this
# method.
def while_preventing_writes(enabled = true)
original, self.prevent_writes = self.prevent_writes, enabled
yield
Expand Down

0 comments on commit bba75d1

Please sign in to comment.