module SwitchConnection::Relation::MonkeyPatch

Public Instance Methods

calculate(*args, &block) click to toggle source
Calls superclass method
# File lib/switch_connection/connection_routing.rb, line 7
def calculate(*args, &block)
  if @klass.switch_point_proxy && !lock_value && @klass.connection.open_transactions.zero?
    @klass.with_slave do
      super
    end
  else
    super
  end
end
exists?(*args, &block) click to toggle source
Calls superclass method
# File lib/switch_connection/connection_routing.rb, line 17
def exists?(*args, &block)
  if @klass.switch_point_proxy && !lock_value && @klass.connection.open_transactions.zero?
    @klass.with_slave do
      super
    end
  else
    super
  end
end
pluck(*args, &block) click to toggle source
Calls superclass method
# File lib/switch_connection/connection_routing.rb, line 27
def pluck(*args, &block)
  if @klass.switch_point_proxy && !lock_value && @klass.connection.open_transactions.zero?
    @klass.with_slave do
      super
    end
  else
    super
  end
end