module ActiveRecord::ConnectionHandling
def while_preventing_writes(enabled = true, &block)
See +READ_QUERY+ for the queries that are blocked by this
user and is meant to be a safeguard against accidental writes.
This method does not provide the same protection as a readonly
will prevent writes to the database for the duration of the block.
even if you are on a database that can write. +while_preventing_writes+
In some cases you may want to prevent writes to the database
Prevent writing to the database regardless of role.
def while_preventing_writes(enabled = true, &block) connected_to(role: current_role, prevent_writes: enabled, &block) end