module ReplicaPools::ActiveRecordExtensions::ClassMethods

Public Instance Methods

connection_proxy() click to toggle source
# File lib/replica_pools/active_record_extensions.rb, line 16
def connection_proxy
  ReplicaPools.proxy
end
transaction(options = {}, &block) click to toggle source

Make sure transactions run on leader Even if they're initiated from ActiveRecord::Base (which doesn't have our hijack).

Calls superclass method
# File lib/replica_pools/active_record_extensions.rb, line 23
def transaction(options = {}, &block)
  if self.connection.kind_of?(ConnectionProxy)
    super
  else
    self.connection_proxy.with_leader { super }
  end
end