module Rails::Sharding
The purpose of this class is to override ActiveRecord::ConnectionHandling methods that access the DB connection or connection pool in any way.
If Rails::Sharding::ShardThreadRegistry.connecting_to_master?
is true, we just delegate all calls to the original methods of ActiveRecord::ConnectionHandling, otherwise we access our own ConnectionHandler
and retrieve the connection or connection pool to the selected shard
Constants
- VERSION
Public Class Methods
method_missing(method_sym, *arguments, &block)
click to toggle source
delegates all methods to Core
, to shorten method calls
# File lib/rails/sharding.rb, line 12 def self.method_missing(method_sym, *arguments, &block) Core.send(method_sym, *arguments, &block) end