Module: ActiveRecord::ConnectionAdapters::JdbcConnectionPoolCallbacks

Included in:
JdbcAdapter
Defined in:
lib/arjdbc/jdbc/callbacks.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/arjdbc/jdbc/callbacks.rb', line 4

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)


14
15
16
# File 'lib/arjdbc/jdbc/callbacks.rb', line 14

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

Instance Method Details

#on_checkinObject



18
19
20
# File 'lib/arjdbc/jdbc/callbacks.rb', line 18

def on_checkin
  # default implementation does nothing
end

#on_checkoutObject



22
23
24
# File 'lib/arjdbc/jdbc/callbacks.rb', line 22

def on_checkout
  # default implementation does nothing
end