Module: SwitchConnection::Model

Defined in:
lib/switch_connection/model.rb

Defined Under Namespace

Modules: ClassMethods, MonkeyPatch

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(model) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/switch_connection/model.rb', line 8

def self.included(model)
  super
  model.singleton_class.class_eval do
    include ClassMethods
    prepend MonkeyPatch
  end
end

Instance Method Details

#transaction_with(*models, &block) ⇒ Object



28
29
30
# File 'lib/switch_connection/model.rb', line 28

def transaction_with(*models, &block)
  self.class.transaction_with(*models, &block)
end

#with_master(&block) ⇒ Object



20
21
22
# File 'lib/switch_connection/model.rb', line 20

def with_master(&block)
  self.class.with_master(&block)
end

#with_slave(&block) ⇒ Object



16
17
18
# File 'lib/switch_connection/model.rb', line 16

def with_slave(&block)
  self.class.with_slave(&block)
end

#with_switch_point(new_switch_point_name, &block) ⇒ Object



24
25
26
# File 'lib/switch_connection/model.rb', line 24

def with_switch_point(new_switch_point_name, &block)
  self.class.with_switch_point(new_switch_point_name, &block)
end