Sha256: 9329df243c252824d4b34b430143844dca65cd141adc7b9b5ceea25947526e15
Contents?: true
Size: 707 Bytes
Versions: 1
Compression:
Stored size: 707 Bytes
Contents
module ActiveRecord module ConnectionAdapters class AbstractAdapter def select_all_with_slave_connection(arel, name = nil, binds = []) if FreshConnection::SlaveConnection.slave_access? change_connection {select_all_without_slave_connection(arel, "[slave] #{name}", binds)} else select_all_without_slave_connection(arel, name, binds) end end alias_method_chain :select_all, :slave_connection private def change_connection master_con, @connection = @connection, FreshConnection::SlaveConnection.connection.raw_connection yield ensure @connection = master_con end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fresh_connection-0.1.0 | lib/fresh_connection/active_record/abstract_adapter.rb |