Class: ActiveRecordShards::ConnectionSwitcher::PrimaryReplicaProxy
- Inherits:
 - 
      Object
      
        
- Object
 - ActiveRecordShards::ConnectionSwitcher::PrimaryReplicaProxy
 
 
- Defined in:
 - lib/active_record_shards/connection_switcher.rb
 
Instance Method Summary collapse
- 
  
    
      #initialize(target, which)  ⇒ PrimaryReplicaProxy 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of PrimaryReplicaProxy.
 - 
  
    
      #method_missing(method, *args, &block)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
rubocop:disable Style/MethodMissingSuper, Style/MissingRespondToMissing.
 
Constructor Details
#initialize(target, which) ⇒ PrimaryReplicaProxy
Returns a new instance of PrimaryReplicaProxy.
      235 236 237 238  | 
    
      # File 'lib/active_record_shards/connection_switcher.rb', line 235 def initialize(target, which) @target = target @which = which end  | 
  
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
rubocop:disable Style/MethodMissingSuper, Style/MissingRespondToMissing
      240 241 242  | 
    
      # File 'lib/active_record_shards/connection_switcher.rb', line 240 def method_missing(method, *args, &block) # rubocop:disable Style/MethodMissingSuper, Style/MissingRespondToMissing @target.on_primary_or_replica(@which) { @target.send(method, *args, &block) } end  |