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
-
#turntable_shard ⇒ ActiveRecord::Turntable::Shard
Current shard for self.
- #with_shard(shard) ⇒ Object
Instance Method Details
#turntable_shard ⇒ ActiveRecord::Turntable::Shard
Returns current shard for self.
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 |