Skip to content

Commit

Permalink
Fix while_preventing_writes for legacy version
Browse files Browse the repository at this point in the history
We need to pass the block along to the connection handler's
`while_preventing_writes`.
  • Loading branch information
eileencodes committed Nov 2, 2020
1 parent 0919871 commit 9c8a7f4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/connection_handling.rb
Expand Up @@ -202,7 +202,7 @@ def connecting_to(role: default_role, shard: default_shard, prevent_writes: fals
# method.
def while_preventing_writes(enabled = true, &block)
if legacy_connection_handling
connection_handler.while_preventing_writes(enabled)
connection_handler.while_preventing_writes(enabled, &block)
else
connected_to(role: current_role, prevent_writes: enabled, &block)
end
Expand Down

0 comments on commit 9c8a7f4

Please sign in to comment.