Module: ActiveRecord::ConnectionAdapters::JdbcAdapter::ConnectionPoolCallbacks

Included in:
ActiveRecord::ConnectionAdapters::JdbcAdapter
Defined in:
lib/active_record/connection_adapters/jdbc_adapter.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



425
426
427
428
429
430
431
432
433
# File 'lib/active_record/connection_adapters/jdbc_adapter.rb', line 425

def self.included(base)
  if base.respond_to?(:set_callback) # Rails 3 callbacks
    base.set_callback :checkin, :after, :on_checkin
    base.set_callback :checkout, :before, :on_checkout
  else
    base.checkin :on_checkin
    base.checkout :on_checkout
  end
end

.needed?Boolean

Returns:

  • (Boolean)


435
436
437
# File 'lib/active_record/connection_adapters/jdbc_adapter.rb', line 435

def self.needed?
  ActiveRecord::Base.respond_to?(:connection_pool)
end

Instance Method Details

#on_checkinObject



439
440
441
# File 'lib/active_record/connection_adapters/jdbc_adapter.rb', line 439

def on_checkin
  # default implementation does nothing
end

#on_checkoutObject



443
444
445
# File 'lib/active_record/connection_adapters/jdbc_adapter.rb', line 443

def on_checkout
  # default implementation does nothing
end