Module: Rails::Sharding

Defined in:
lib/rails/sharding/shardable_model.rb,
lib/rails/sharding.rb,
lib/rails/sharding/core.rb,
lib/rails/sharding/config.rb,
lib/rails/sharding/errors.rb,
lib/rails/sharding/railtie.rb,
lib/rails/sharding/version.rb,
lib/rails/sharding/connection_handler.rb,
lib/rails/sharding/shard_thread_registry.rb,
lib/rails/sharding/active_record_extensions.rb

Overview

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

Defined Under Namespace

Modules: ActiveRecordExtensions, Errors, ShardableModel Classes: Config, ConnectionHandler, Core, Railtie, ShardThreadRegistry

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.method_missing(method_sym, *arguments, &block) ⇒ Object

delegates all methods to Core, to shorten method calls



13
14
15
# File 'lib/rails/sharding.rb', line 13

def self.method_missing(method_sym, *arguments, &block)
  Core.send(method_sym, *arguments, &block)
end