Module: Stagehand::Connection

Defined in:
lib/stagehand/connection_adapter_extensions.rb

Defined Under Namespace

Modules: AdapterExtensions

Class Method Summary collapse

Class Method Details

.with_production_writes(model, &block) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/stagehand/connection_adapter_extensions.rb', line 3

def self.with_production_writes(model, &block)
  state = model.connection.readonly?
  model.connection.readonly!(false)
  return block.call
ensure
  model.connection.readonly!(state)
end