Class: ActiveRecord::Turntable::DefaultShard
- Defined in:
- lib/active_record/turntable/default_shard.rb
Instance Attribute Summary
Attributes inherited from Shard
Instance Method Summary collapse
- #connection_pool ⇒ Object
-
#initialize(klass) ⇒ DefaultShard
constructor
A new instance of DefaultShard.
- #support_slave? ⇒ Boolean
Methods inherited from Shard
#connection, connection_classes, #current_slave_shard, #use_slave?
Constructor Details
#initialize(klass) ⇒ DefaultShard
Returns a new instance of DefaultShard.
3 4 5 6 7 8 |
# File 'lib/active_record/turntable/default_shard.rb', line 3 def initialize(klass) (klass and original_connection_pool(klass)) or raise DefaultShardNotConnected, "connection_pool is nil" @klass = klass @name = "master" end |
Instance Method Details
#connection_pool ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/active_record/turntable/default_shard.rb', line 10 def connection_pool if ActiveRecord::Base == @klass ActiveRecord::Base.connection_pool else # use original parent class connection which is turntable disabled original_connection_pool end end |
#support_slave? ⇒ Boolean
19 20 21 |
# File 'lib/active_record/turntable/default_shard.rb', line 19 def support_slave? false end |