Class: Yrpc::Interceptors::ActiveRecord::ResetConnection

Inherits:
Object
  • Object
show all
Defined in:
lib/yrpc/interceptors/active_record.rb

Instance Method Summary collapse

Instance Method Details

#invokeObject



6
7
8
9
10
11
12
13
# File 'lib/yrpc/interceptors/active_record.rb', line 6

def invoke
  if enabled? && !::ActiveRecord::Base.connection.active?
    ::ActiveRecord::Base.establish_connection
  end
  yield
ensure
  ::ActiveRecord::Base.clear_active_connections! if enabled?
end