public
Description: ActiveRecord connection proxy for master/slave connections
Clone URL: git://github.com/technoweenie/masochism.git
better documentation and fixed a typo and a superfluous conditional
abloom (author)
Wed Oct 01 12:30:20 -0700 2008
commit  176aa0e93040088ae8c8a8bee7b8b4780b2c2e37
tree    38e4c0a22d4f2f1a443cda6b4e156dda87dcbb95
parent  4aaa0298207ec5042f66afcc68ccb69ae4e5b48f
0
...
78
79
80
81
 
82
83
84
85
...
78
79
80
 
81
82
83
84
85
0
@@ -78,7 +78,7 @@ Using the MasterFilter class is quite simple. If you have any actions you know r
0
 the Master DB for both reads and writes simply do the following:
0
 
0
 class RandomController < ApplicationController
0
- around_filter MasterFilter, :only => [:show, :edit, :update]
0
+ around_filter ActiveReload::MasterFilter, :only => [:show, :edit, :update]
0
   
0
   ...
0
 end
0
\ No newline at end of file
...
39
40
41
42
 
43
44
45
...
39
40
41
 
42
43
44
45
0
@@ -39,7 +39,7 @@ module ActiveReload
0
     end
0
     
0
     def set_to_slave!
0
- return if @current == @master
0
+ return if @current == @slave
0
       
0
       logger.info "Switching to Slave"
0
       @current = @slave
...
4
5
6
7
 
8
9
10
...
4
5
6
 
7
8
9
10
0
@@ -4,7 +4,7 @@ module ActiveReload
0
     def self.filter(controller, &block)
0
       proxy = ActiveRecord::Base.active_connections['ActiveRecord::Base']
0
 
0
- if proxy and proxy.respond_to?(:with_master)
0
+ if proxy.respond_to?(:with_master)
0
         proxy.with_master(&block)
0
       else
0
         yield block

Comments

    No one has commented yet.