Module: ActiveRecord::Turntable::Base

Extended by:
ActiveSupport::Concern
Defined in:
lib/active_record/turntable/base.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#turntable_shardActiveRecord::Turntable::Shard

Returns current shard for self.

Returns:



121
122
123
# File 'lib/active_record/turntable/base.rb', line 121

def turntable_shard
  turntable_cluster.shard_for(self.send(turntable_shard_key))
end

#with_shard(shard) ⇒ Object



126
127
128
# File 'lib/active_record/turntable/base.rb', line 126

def with_shard(shard)
  self.class.connection.with_shard(shard) { yield }
end