master_slave_adapter_tcurdt 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -153,13 +153,26 @@ module ActiveRecord
153
153
 
154
154
  def transaction(*args)
155
155
  # puts "<transaction"
156
- yield
156
+ result = yield
157
157
  # puts "</transaction"
158
158
  update_clock
159
+ result
159
160
  end
160
161
 
161
162
  class << self
162
163
 
164
+ def with_master(&block)
165
+ ActiveRecord::Base.with_master(&block)
166
+ end
167
+
168
+ def with_slave(&block)
169
+ ActiveRecord::Base.with_slave(&block)
170
+ end
171
+
172
+ def with_consitency(clock, &block)
173
+ ActiveRecord::Base.with_slave(clock, &block)
174
+ end
175
+
163
176
  def reset!
164
177
  Thread.current[:master_slave_connection] = nil
165
178
  Thread.current[:master_slave_clock] = nil
@@ -1,3 +1,3 @@
1
1
  module MasterSlaveAdapter
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 4
9
- version: 0.0.4
8
+ - 5
9
+ version: 0.0.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Mauricio Linhares