diff options
author | Eileen M. Uchitelle <eileencodes@users.noreply.github.com> | 2019-08-02 13:03:03 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-02 13:03:03 -0400 |
commit | ac7c9381f02446bb4e1681ad66cd69d8abe23594 (patch) | |
tree | 4a12db093039c6d9546d37668a53996e80e54e61 /activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb | |
parent | f3c68c59ed57302ca54f4dfad0e91dbff426962d (diff) | |
parent | f2de448106ca3bb947dc88f96ca7d81d37b5be9a (diff) | |
download | rails-ac7c9381f02446bb4e1681ad66cd69d8abe23594.tar.gz rails-ac7c9381f02446bb4e1681ad66cd69d8abe23594.tar.bz2 rails-ac7c9381f02446bb4e1681ad66cd69d8abe23594.zip |
Merge pull request #36843 from eileencodes/add-ability-to-unset-preventing-writes
Add ability to unset preventing writes
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb index 36001efdd5..276d5a25d4 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb @@ -1020,8 +1020,8 @@ module ActiveRecord # 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. - def while_preventing_writes - original, @prevent_writes = @prevent_writes, true + def while_preventing_writes(enabled = true) + original, @prevent_writes = @prevent_writes, enabled yield ensure @prevent_writes = original |