Class: ActiveRecordShards::ConnectionSwitcher::MasterSlaveProxy
- Inherits:
-
Object
- Object
- ActiveRecordShards::ConnectionSwitcher::MasterSlaveProxy
- Defined in:
- lib/active_record_shards/connection_switcher.rb
Instance Method Summary collapse
-
#initialize(target, which) ⇒ MasterSlaveProxy
constructor
A new instance of MasterSlaveProxy.
- #method_missing(method, *args, &block) ⇒ Object
Constructor Details
#initialize(target, which) ⇒ MasterSlaveProxy
258 259 260 261 |
# File 'lib/active_record_shards/connection_switcher.rb', line 258 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
263 264 265 |
# File 'lib/active_record_shards/connection_switcher.rb', line 263 def method_missing(method, *args, &block) @target.on_master_or_slave(@which) { @target.send(method, *args, &block) } end |