Skip to content

Commit

Permalink
backwards compatibility API,
Browse files Browse the repository at this point in the history
preserve transaction return code
  • Loading branch information
tcurdt committed Jun 6, 2011
1 parent a49c46c commit a9fed3e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 14 additions & 1 deletion lib/master_slave_adapter/adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,26 @@ def with_consistency(clock)

def transaction(*args)
# puts "<transaction"
yield
result = yield
# puts "</transaction"
update_clock
result
end

class << self

def with_master(&block)
ActiveRecord::Base.with_master(&block)
end

def with_slave(&block)
ActiveRecord::Base.with_slave(&block)
end

def with_consitency(clock, &block)
ActiveRecord::Base.with_slave(clock, &block)
end

def reset!
Thread.current[:master_slave_connection] = nil
Thread.current[:master_slave_clock] = nil
Expand Down
2 changes: 1 addition & 1 deletion lib/master_slave_adapter/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module MasterSlaveAdapter
VERSION = "0.0.4"
VERSION = "0.0.5"
end

0 comments on commit a9fed3e

Please sign in to comment.