Skip to content
This repository was archived by the owner on Aug 26, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/active_record/turntable/active_record_ext/fixtures.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
require 'active_record/fixtures'
module ActiveRecord
class Fixtures
class FixtureSet
def self.create_fixtures(fixtures_directory, table_names, class_names = {})
table_names = [table_names].flatten.map { |n| n.to_s }
table_names.each { |n|
Expand Down
8 changes: 6 additions & 2 deletions lib/active_record/turntable/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ def force_connect_all_shards!
def turntable_replace_connection_pool
ch = connection_handler
cp = turntable_cluster.connection_proxy
if ActiveRecord::VERSION::STRING >= '3.2.0'
if ActiveRecord::VERSION::STRING >= '4.0.0'
proxy = PoolProxy.new(cp)
ch.send(:owner_to_pool)[name] = proxy
ch.send(:class_to_pool)[name] = proxy
elsif ActiveRecord::VERSION::STRING >= '3.2.0'
ch.connection_pools[cp.spec] = PoolProxy.new(cp)
ch.instance_variable_get(:@class_to_pool)[name] = ch.connection_pools[cp.spec]
else
Expand All @@ -77,7 +81,7 @@ def spec_for(config)
raise "Please install the #{config['adapter']} adapter: `gem install activerecord-#{config['adapter']}-adapter` (#{e})"
end
adapter_method = "#{config['adapter']}_connection"
ActiveRecord::Base::ConnectionSpecification.new(config, adapter_method)
ActiveRecord::ConnectionAdapters::ConnectionSpecification.new(config, adapter_method)
end

def clear_all_connections!
Expand Down
2 changes: 1 addition & 1 deletion lib/active_record/turntable/shard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def spec_for(config)
raise "Please install the #{adapter} adapter: `gem install activerecord-#{adapter}-adapter` (#{e})"
end
adapter_method = "#{adapter}_connection"
ActiveRecord::Base::ConnectionSpecification.new(config, adapter_method)
ActiveRecord::ConnectionAdapters::ConnectionSpecification.new(config, adapter_method)
end
end
end
Expand Down