Sha256: 30afcf9992219067871d1bdf4c28d5b6311509fa0f4b5e43a54a72b3809c8403
Contents?: true
Size: 941 Bytes
Versions: 9
Compression:
Stored size: 941 Bytes
Contents
module Arql::Commands module Sandbox class << self attr_accessor :enabled @sandbox_callback = proc do begin_transaction(joinable: false) end def enter ActiveRecord::ConnectionAdapters::AbstractAdapter.set_callback(:checkout, :after, &@sandbox_callback) Arql::App.instance.definitions.each do |_, definition| definition.connection.begin_transaction(joinable: false) end @enabled = true end def quit ActiveRecord::ConnectionAdapters::AbstractAdapter.skip_callback(:checkout, :after, &@sandbox_callback) Arql::App.instance.definitions.each do |_, definition| definition.connection.rollback_transaction end @enabled = false end end Pry.commands.block_command 'sandbox-enter' do Sandbox.enter end Pry.commands.block_command 'sandbox-quit' do Sandbox.quit end end end
Version data entries
9 entries across 9 versions & 1 rubygems