未验证 提交 82217c21 编写于 作者: E eileencodes

Improve while_preventing_writes documentation

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: NEike Send <eike.send@gmail.com>
上级 7dc53ec9
......@@ -1015,6 +1015,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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册