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
- #shards_transaction(options = {}, &block) ⇒ Object
-
#turntable_shard ⇒ ActiveRecord::Turntable::Shard
Current shard for self.
- #with_shard(shard) ⇒ Object
Instance Method Details
#shards_transaction(options = {}, &block) ⇒ Object
111 112 113 |
# File 'lib/active_record/turntable/base.rb', line 111 def shards_transaction( = {}, &block) self.class.shards_transaction(, &block) end |
#turntable_shard ⇒ ActiveRecord::Turntable::Shard
Returns current shard for self.
116 117 118 |
# File 'lib/active_record/turntable/base.rb', line 116 def turntable_shard turntable_cluster.shard_for(self.send(turntable_shard_key)) end |
#with_shard(shard) ⇒ Object
121 122 123 |
# File 'lib/active_record/turntable/base.rb', line 121 def with_shard(shard) self.class.connection.with_shard(shard) { yield } end |