Class: Octoball
- Inherits:
-
Object
- Object
- Octoball
- Defined in:
- lib/octoball/log_subscriber.rb,
lib/octoball.rb,
lib/octoball/version.rb,
lib/octoball/association.rb,
lib/octoball/persistence.rb,
lib/octoball/relation_proxy.rb,
lib/octoball/connection_adapters.rb,
lib/octoball/connection_handling.rb,
lib/octoball/current_shard_tracker.rb,
lib/octoball/association_shard_check.rb
Overview
Implementation courtesy of db-charmer.
Defined Under Namespace
Modules: AssociationShardCheck, AssociationShardChecker, ConnectionHandlerSetCurrentShard, ConnectionHandlingAvoidAutoLoadProxy, ConnectionHasCurrentShard, CurrentShardTracker, LogSubscriber, RelationCurrentShard, ShardedCollectionAssociation, ShardedCollectionProxy, ShardedPersistence, ShardedSingularAssociation, UsingShard Classes: MismatchedShards, RelationProxy
Constant Summary collapse
- VERSION =
'0.1.1'
Class Method Summary collapse
Methods included from UsingShard
Methods included from AssociationShardChecker
#has_and_belongs_to_many, #has_many
Class Method Details
.current_role ⇒ Object
19 20 21 |
# File 'lib/octoball.rb', line 19 def self.current_role ActiveRecord::Base.current_role || ActiveRecord::Base.writing_role end |
.using(shard, &block) ⇒ Object
15 16 17 |
# File 'lib/octoball.rb', line 15 def self.using(shard, &block) ActiveRecord::Base.connected_to(role: current_role, shard: shard&.to_sym, &block) end |