From c3752df79be4ed149cc62feeab4970b9cd2a96fb Mon Sep 17 00:00:00 2001 From: David Kutalek Date: Tue, 13 Aug 2024 11:39:23 -0700 Subject: [PATCH 01/14] update to rails 7.0 support, remove depreciated api reference --- knockoff.gemspec | 4 ++-- lib/knockoff/config.rb | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/knockoff.gemspec b/knockoff.gemspec index e23aa79..7aebc6c 100644 --- a/knockoff.gemspec +++ b/knockoff.gemspec @@ -18,8 +18,8 @@ Gem::Specification.new do |spec| spec.bindir = "bin" spec.require_paths = ["lib"] - spec.add_runtime_dependency 'activerecord', '>= 6', '< 7' - spec.add_runtime_dependency 'activesupport', '>= 6', '< 7' + spec.add_runtime_dependency 'activerecord', '~> 7.0' + spec.add_runtime_dependency 'activesupport', '~> 7.0' spec.add_development_dependency "bundler" spec.add_development_dependency "rake", "~> 10.0" diff --git a/lib/knockoff/config.rb b/lib/knockoff/config.rb index 154f211..74adea9 100644 --- a/lib/knockoff/config.rb +++ b/lib/knockoff/config.rb @@ -35,7 +35,7 @@ def replica_env_keys def update_replica_configs(new_configs) if ActiveRecord::Base.configurations.configs_for(env_name: 'knockoff_replicas').present? - updated_config = new_configs.deep_dup.merge!(ActiveRecord::Base.configurations.configs_for(env_name: 'knockoff_replicas').first.config) + updated_config = new_configs.deep_dup.merge!(ActiveRecord::Base.configurations.configs_for(env_name: 'knockoff_replicas').first.configuration_hash) end @replicas_configurations.each do |key, _config| @@ -53,7 +53,7 @@ def properly_configured? private def update_replica_config(key, updated_config) - merged_config = @replicas_configurations[key].config.deep_dup.merge!(updated_config) + merged_config = @replicas_configurations[key].configuration_hash.deep_dup.merge!(updated_config) @replicas_configurations[key] = ActiveRecord::DatabaseConfigurations::HashConfig.new(key, key, merged_config) ActiveRecord::Base.configurations.configurations << @replicas_configurations[key] end @@ -69,7 +69,7 @@ def parse_knockoff_replica_envs_to_configs begin # Configure parameters such as prepared_statements, pool, reaping_frequency for all replicas. - to_copy = ActiveRecord::Base.configurations.configs_for(env_name: 'knockoff_replicas')&.first&.config || {} + to_copy = ActiveRecord::Base.configurations.configs_for(env_name: 'knockoff_replicas')&.first&.configuration_hash || {} register_replica_copy(index, env_key, to_copy) rescue URI::InvalidURIError From d1f845f23c2da6e9e38d1b5cd0634096ed7977ca Mon Sep 17 00:00:00 2001 From: David Kutalek Date: Tue, 13 Aug 2024 11:56:42 -0700 Subject: [PATCH 02/14] run bundle install --- Gemfile.lock | 18 ++++++++---------- knockoff.gemspec | 4 ++-- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index a45e75e..926d940 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,23 +2,22 @@ PATH remote: . specs: knockoff (1.4.0) - activerecord (>= 6, < 7) - activesupport (>= 6, < 7) + activerecord (~> 7.0.0) + activesupport (~> 7.0.0) GEM remote: https://rubygems.org/ specs: - activemodel (6.1.7.8) - activesupport (= 6.1.7.8) - activerecord (6.1.7.8) - activemodel (= 6.1.7.8) - activesupport (= 6.1.7.8) - activesupport (6.1.7.8) + activemodel (7.0.8.4) + activesupport (= 7.0.8.4) + activerecord (7.0.8.4) + activemodel (= 7.0.8.4) + activesupport (= 7.0.8.4) + activesupport (7.0.8.4) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) - zeitwerk (~> 2.3) concurrent-ruby (1.3.4) diff-lcs (1.5.1) i18n (1.14.5) @@ -46,7 +45,6 @@ GEM sqlite3 (1.5.4-x86_64-linux) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - zeitwerk (2.6.17) PLATFORMS aarch64-linux diff --git a/knockoff.gemspec b/knockoff.gemspec index 7aebc6c..9b50de6 100644 --- a/knockoff.gemspec +++ b/knockoff.gemspec @@ -18,8 +18,8 @@ Gem::Specification.new do |spec| spec.bindir = "bin" spec.require_paths = ["lib"] - spec.add_runtime_dependency 'activerecord', '~> 7.0' - spec.add_runtime_dependency 'activesupport', '~> 7.0' + spec.add_runtime_dependency 'activerecord', '~> 7.0.0' + spec.add_runtime_dependency 'activesupport', '~> 7.0.0' spec.add_development_dependency "bundler" spec.add_development_dependency "rake", "~> 10.0" From be3c75fc1c2f05d9811820f2e9a5f02e646df0e9 Mon Sep 17 00:00:00 2001 From: David Kutalek Date: Tue, 13 Aug 2024 12:48:51 -0700 Subject: [PATCH 03/14] test fixes --- lib/knockoff.rb | 2 +- lib/knockoff/config.rb | 48 ++++++++++++------------- lib/knockoff/replica_connection_pool.rb | 4 ++- spec/knockoff_spec.rb | 2 +- 4 files changed, 27 insertions(+), 29 deletions(-) diff --git a/lib/knockoff.rb b/lib/knockoff.rb index ec3a29f..6e39571 100644 --- a/lib/knockoff.rb +++ b/lib/knockoff.rb @@ -25,7 +25,7 @@ def default_target=(target) end def replica_pool - @replica_pool ||= ReplicaConnectionPool.new(config.replica_database_keys) + @replica_pool ||= ReplicaConnectionPool.new(config.replicas_configurations.keys) end def clear_all_active_connections! diff --git a/lib/knockoff/config.rb b/lib/knockoff/config.rb index 74adea9..5aaa678 100644 --- a/lib/knockoff/config.rb +++ b/lib/knockoff/config.rb @@ -21,8 +21,28 @@ def initialize end end - def replica_database_keys - @replicas_configurations.keys + def set_replica_configs + @replica_configs ||= parse_knockoff_replica_envs_to_configs + end + + def parse_knockoff_replica_envs_to_configs + # As a basic prevention of crashes, attempt to parse each DB uri + # and don't add the uri to the final list if it can't be parsed + replica_env_keys.map.with_index(0) do |env_key, index| + begin + + # Configure parameters such as prepared_statements, pool, reaping_frequency for all replicas. + to_copy = ActiveRecord::Base.configurations.configs_for(env_name: 'knockoff_replicas')&.first&.configuration_hash || {} + register_replica_copy(index, env_key, to_copy) + + rescue URI::InvalidURIError + Rails.logger.info "LOG NOTIFIER: Invalid URL specified in follower_env_keys. Not including URI, which may result in no followers used." # URI is purposely not printed to logs + # Return a 'nil' which will be removed from + # configs with `compact`, resulting in no configs and no followers, + # therefore disabled since this env will not be in environments list. + nil + end + end.compact end def replica_env_keys @@ -58,30 +78,6 @@ def update_replica_config(key, updated_config) ActiveRecord::Base.configurations.configurations << @replicas_configurations[key] end - def set_replica_configs - @replica_configs ||= parse_knockoff_replica_envs_to_configs - end - - def parse_knockoff_replica_envs_to_configs - # As a basic prevention of crashes, attempt to parse each DB uri - # and don't add the uri to the final list if it can't be parsed - replica_env_keys.map.with_index(0) do |env_key, index| - begin - - # Configure parameters such as prepared_statements, pool, reaping_frequency for all replicas. - to_copy = ActiveRecord::Base.configurations.configs_for(env_name: 'knockoff_replicas')&.first&.configuration_hash || {} - register_replica_copy(index, env_key, to_copy) - - rescue URI::InvalidURIError - Rails.logger.info "LOG NOTIFIER: Invalid URL specified in follower_env_keys. Not including URI, which may result in no followers used." # URI is purposely not printed to logs - # Return a 'nil' which will be removed from - # configs with `compact`, resulting in no configs and no followers, - # therefore disabled since this env will not be in environments list. - nil - end - end.compact - end - def register_replica_copy(index, env_key, configuration_hash) key = "knockoff_replica_#{index}" new_config = create_replica_copy(env_key, key, configuration_hash.deep_dup) diff --git a/lib/knockoff/replica_connection_pool.rb b/lib/knockoff/replica_connection_pool.rb index b9381c0..b2dffd7 100644 --- a/lib/knockoff/replica_connection_pool.rb +++ b/lib/knockoff/replica_connection_pool.rb @@ -46,6 +46,8 @@ def connection_class(config_key) # Config key is of schema 'knockoff_replica_n' class_name = "KnockoffReplica#{config_key.split('_').last}" + puts "config_key: #{config_key} was something" + # TODO: Hardcoding the uri string feels meh. Either set the database config # or reference ENV instead Knockoff.module_eval %Q{ @@ -53,7 +55,7 @@ class #{class_name} < ActiveRecord::Base self.abstract_class = true establish_connection :#{config_key} def self.connection_db_config - configurations[#{config_key.to_s.inspect}] + configurations.find_db_config #{config_key.to_s.inspect} end end }, __FILE__, __LINE__ diff --git a/spec/knockoff_spec.rb b/spec/knockoff_spec.rb index 502d299..654628e 100644 --- a/spec/knockoff_spec.rb +++ b/spec/knockoff_spec.rb @@ -142,7 +142,7 @@ class ActiveRecord::Relation it 'defines self.connection_db_config' do expect(Knockoff::KnockoffReplica0.connection_db_config).not_to be_nil - expect(Knockoff::KnockoffReplica0.connection_db_config[:adapter]).to eq 'sqlite3' + expect(Knockoff::KnockoffReplica0.connection_db_config.adapter).to eq 'sqlite3' end context "bad configurations" do From 94bfb5836b0517e103562a7d5b5bb48f37c35904 Mon Sep 17 00:00:00 2001 From: David Kutalek Date: Tue, 13 Aug 2024 12:54:53 -0700 Subject: [PATCH 04/14] remove support for ruby 2.6 since active record 7 does not support --- .github/workflows/ruby.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 5c1de93..816f273 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: - ruby-version: ['2.6.10', '2.7.8', '3.0.6', '3.1.4'] + ruby-version: ['2.7.8', '3.0.6', '3.1.4'] steps: # Pin to this commit: v2 From efbf1c146573f6d1af088ca609984e1e511f1e9e Mon Sep 17 00:00:00 2001 From: David Kutalek Date: Wed, 14 Aug 2024 09:44:59 -0700 Subject: [PATCH 05/14] Backwards support 6.1 --- Gemfile.lock | 4 ++-- knockoff.gemspec | 4 ++-- lib/knockoff/replica_connection_pool.rb | 2 -- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 926d940..4e59521 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,8 +2,8 @@ PATH remote: . specs: knockoff (1.4.0) - activerecord (~> 7.0.0) - activesupport (~> 7.0.0) + activerecord (>= 6.1, < 7.1) + activesupport (>= 6.1, < 7.1) GEM remote: https://rubygems.org/ diff --git a/knockoff.gemspec b/knockoff.gemspec index 9b50de6..456f8b5 100644 --- a/knockoff.gemspec +++ b/knockoff.gemspec @@ -18,8 +18,8 @@ Gem::Specification.new do |spec| spec.bindir = "bin" spec.require_paths = ["lib"] - spec.add_runtime_dependency 'activerecord', '~> 7.0.0' - spec.add_runtime_dependency 'activesupport', '~> 7.0.0' + spec.add_runtime_dependency 'activerecord', '>= 6.1', "< 7.1" + spec.add_runtime_dependency 'activesupport', '>= 6.1', "< 7.1" spec.add_development_dependency "bundler" spec.add_development_dependency "rake", "~> 10.0" diff --git a/lib/knockoff/replica_connection_pool.rb b/lib/knockoff/replica_connection_pool.rb index b2dffd7..23577bc 100644 --- a/lib/knockoff/replica_connection_pool.rb +++ b/lib/knockoff/replica_connection_pool.rb @@ -46,8 +46,6 @@ def connection_class(config_key) # Config key is of schema 'knockoff_replica_n' class_name = "KnockoffReplica#{config_key.split('_').last}" - puts "config_key: #{config_key} was something" - # TODO: Hardcoding the uri string feels meh. Either set the database config # or reference ENV instead Knockoff.module_eval %Q{ From 4e3a56be44ae81185152d0e99592a12c98a115cd Mon Sep 17 00:00:00 2001 From: David Kutalek Date: Wed, 14 Aug 2024 12:19:32 -0700 Subject: [PATCH 06/14] Update version and changelog --- CHANGELOG.md | 4 +++- lib/knockoff/version.rb | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6aa19ec..3f59ed5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,6 @@ -## Unreleased +## 1.5.0 + +Update to be Rails 7.0 compatible. Drops support for ruby 2.6 and Rails 6.0- ## 1.4.0 diff --git a/lib/knockoff/version.rb b/lib/knockoff/version.rb index dfd1bc3..0ca3d11 100644 --- a/lib/knockoff/version.rb +++ b/lib/knockoff/version.rb @@ -1,3 +1,3 @@ module Knockoff - VERSION = '1.4.0'.freeze + VERSION = '1.5.0'.freeze end From a8da25dd51e1f30dbae5cd62c32d44f42b84b590 Mon Sep 17 00:00:00 2001 From: David Kutalek Date: Wed, 14 Aug 2024 12:20:01 -0700 Subject: [PATCH 07/14] budle install --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 4e59521..fd00d51 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - knockoff (1.4.0) + knockoff (1.5.0) activerecord (>= 6.1, < 7.1) activesupport (>= 6.1, < 7.1) From 135c4c83ebea83288fc1fd2871acb11e116db09e Mon Sep 17 00:00:00 2001 From: David Kutalek Date: Wed, 14 Aug 2024 12:24:22 -0700 Subject: [PATCH 08/14] rename var for clarity --- lib/knockoff/config.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/knockoff/config.rb b/lib/knockoff/config.rb index 5aaa678..82682bb 100644 --- a/lib/knockoff/config.rb +++ b/lib/knockoff/config.rb @@ -8,11 +8,11 @@ class Config attr_reader :replica_configs # A hash of replica configs to their config hash. - attr_reader :replicas_configurations + attr_reader :replicas_configuration_hash def initialize @environment = 'development' - @replicas_configurations = {} + @replicas_configuration_hash = {} set_replica_configs if !properly_configured? && Knockoff.enabled @@ -58,7 +58,7 @@ def update_replica_configs(new_configs) updated_config = new_configs.deep_dup.merge!(ActiveRecord::Base.configurations.configs_for(env_name: 'knockoff_replicas').first.configuration_hash) end - @replicas_configurations.each do |key, _config| + @replicas_configuration_hash.each do |key, _config| update_replica_config(key, updated_config) end end @@ -73,16 +73,16 @@ def properly_configured? private def update_replica_config(key, updated_config) - merged_config = @replicas_configurations[key].configuration_hash.deep_dup.merge!(updated_config) - @replicas_configurations[key] = ActiveRecord::DatabaseConfigurations::HashConfig.new(key, key, merged_config) - ActiveRecord::Base.configurations.configurations << @replicas_configurations[key] + merged_config = @replicas_configuration_hash[key].configuration_hash.deep_dup.merge!(updated_config) + @replicas_configuration_hash[key] = ActiveRecord::DatabaseConfigurations::HashConfig.new(key, key, merged_config) + ActiveRecord::Base.configurations.configurations << @replicas_configuration_hash[key] end def register_replica_copy(index, env_key, configuration_hash) key = "knockoff_replica_#{index}" new_config = create_replica_copy(env_key, key, configuration_hash.deep_dup) ActiveRecord::Base.configurations.configurations << new_config - @replicas_configurations[key] = new_config + @replicas_configuration_hash[key] = new_config end def create_replica_copy(env_key, key, replica_config_hash) From dc868b8fed0aff0cbc77133ad10d6af17bf5a98e Mon Sep 17 00:00:00 2001 From: David Kutalek Date: Wed, 14 Aug 2024 12:50:26 -0700 Subject: [PATCH 09/14] add required_ruby_version to gemspec --- knockoff.gemspec | 1 + 1 file changed, 1 insertion(+) diff --git a/knockoff.gemspec b/knockoff.gemspec index 456f8b5..5aa3f79 100644 --- a/knockoff.gemspec +++ b/knockoff.gemspec @@ -13,6 +13,7 @@ Gem::Specification.new do |spec| spec.homepage = "https://github.com/sgringwe/knockoff" spec.license = "MIT" + spec.required_ruby_version = '>= 2.7.0' spec.platform = Gem::Platform::RUBY spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } spec.bindir = "bin" From a6c5f61f1b0a64355e1d53747a1a6c210665a6e0 Mon Sep 17 00:00:00 2001 From: David Kutalek Date: Wed, 14 Aug 2024 13:06:04 -0700 Subject: [PATCH 10/14] reverty minor code refactor --- lib/knockoff.rb | 2 +- lib/knockoff/config.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/knockoff.rb b/lib/knockoff.rb index 6e39571..ec3a29f 100644 --- a/lib/knockoff.rb +++ b/lib/knockoff.rb @@ -25,7 +25,7 @@ def default_target=(target) end def replica_pool - @replica_pool ||= ReplicaConnectionPool.new(config.replicas_configurations.keys) + @replica_pool ||= ReplicaConnectionPool.new(config.replica_database_keys) end def clear_all_active_connections! diff --git a/lib/knockoff/config.rb b/lib/knockoff/config.rb index 82682bb..723329a 100644 --- a/lib/knockoff/config.rb +++ b/lib/knockoff/config.rb @@ -70,6 +70,10 @@ def properly_configured? !@replica_configs.empty? end + def replica_database_keys + @replicas_configuration_hash.keys + end + private def update_replica_config(key, updated_config) From f14ad03d0b39866bfe4955eb5ed3ed178b29ab63 Mon Sep 17 00:00:00 2001 From: David Kutalek Date: Wed, 14 Aug 2024 13:32:10 -0700 Subject: [PATCH 11/14] Add best guess at supported versions to readme --- README.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5e526b8..510acbd 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,27 @@ A gem for easily using read replicas. ## Supported Versions -Knockoff supports Rails 4, 5 and 6 +| Knockoff version: | 1.0 | 1.1.0 | 1.1.1 | 1.4 | 1.5 | +| Ruby 2.2 | [x] | [ ] | [ ] | [ ] | [ ] | +| Ruby 2.3 | [x] | [x] | [ ] | [ ] | [ ] | +| Ruby 2.4 | [x] | [x] | [x] | [ ] | [ ] | +| Ruby 2.5 | [ ] | [x] | [x] | [ ] | [ ] | +| Ruby 2.6 | [ ] | [ ] | [x] | [x] | [ ] | +| Ruby 2.7 | [ ] | [ ] | [x] | [x] | [x] | +| Ruby 3.0 | [ ] | [ ] | [ ] | [x] | [x] | +| Ruby 3.1 | [ ] | [ ] | [ ] | [x] | [x] | + +| Knockoff version: | 1.0 | 1.1.0 | 1.1.1 | 1.4 | 1.5 | +| Rails 4 | [x] | [x] | [ ] | [ ] | [ ] | +| Rails 5.0 | [x] | [x] | [x] | [ ] | [ ] | +| Rails 5.1 | [x] | [x] | [x] | [ ] | [ ] | +| Rails 5.2 | [x] | [x] | [x] | [ ] | [ ] | +| Rails 6.0 | [ ] | [ ] | [x] | [x] | [ ] | +| Rails 6.1 | [ ] | [ ] | [ ] | [x] | [x] | +| Rails 7.0 | [ ] | [ ] | [ ] | [ ] | [x] | +| Rails 7.1 | [ ] | [ ] | [ ] | [ ] | [ ] | +| Rails 7.2 | [ ] | [ ] | [ ] | [ ] | [ ] | + ## Installation From 9146b2b8db5712523c05520453e39d7c69917ea0 Mon Sep 17 00:00:00 2001 From: David Kutalek Date: Wed, 14 Aug 2024 15:23:56 -0700 Subject: [PATCH 12/14] doc fixes --- CHANGELOG.md | 2 ++ README.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f59ed5..bf91a8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +## Unreleased + ## 1.5.0 Update to be Rails 7.0 compatible. Drops support for ruby 2.6 and Rails 6.0- diff --git a/README.md b/README.md index 510acbd..482d69c 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ A gem for easily using read replicas. ## Supported Versions | Knockoff version: | 1.0 | 1.1.0 | 1.1.1 | 1.4 | 1.5 | +| -------- | ------- | -------- | ------- | -------- | | Ruby 2.2 | [x] | [ ] | [ ] | [ ] | [ ] | | Ruby 2.3 | [x] | [x] | [ ] | [ ] | [ ] | | Ruby 2.4 | [x] | [x] | [x] | [ ] | [ ] | @@ -28,6 +29,7 @@ A gem for easily using read replicas. | Ruby 3.1 | [ ] | [ ] | [ ] | [x] | [x] | | Knockoff version: | 1.0 | 1.1.0 | 1.1.1 | 1.4 | 1.5 | +| -------- | ------- | -------- | ------- | -------- | | Rails 4 | [x] | [x] | [ ] | [ ] | [ ] | | Rails 5.0 | [x] | [x] | [x] | [ ] | [ ] | | Rails 5.1 | [x] | [x] | [x] | [ ] | [ ] | From 5eccf7e89faa121370f112dbd86eaa7f8e2415e1 Mon Sep 17 00:00:00 2001 From: David Kutalek Date: Thu, 15 Aug 2024 15:24:23 -0700 Subject: [PATCH 13/14] set ActiveRecord::Base to global scope since it is erroring when used as path in host gemfile --- lib/knockoff/base.rb | 2 +- lib/knockoff/replica_connection_pool.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/knockoff/base.rb b/lib/knockoff/base.rb index f1c5022..63c0c1f 100644 --- a/lib/knockoff/base.rb +++ b/lib/knockoff/base.rb @@ -28,7 +28,7 @@ def decide_with(target, check_transaction) end def inside_transaction? - open_transactions = run_on(:primary) { ActiveRecord::Base.connection.open_transactions } + open_transactions = run_on(:primary) { ::ActiveRecord::Base.connection.open_transactions } open_transactions > Knockoff.base_transaction_depth end diff --git a/lib/knockoff/replica_connection_pool.rb b/lib/knockoff/replica_connection_pool.rb index 23577bc..2aca6a2 100644 --- a/lib/knockoff/replica_connection_pool.rb +++ b/lib/knockoff/replica_connection_pool.rb @@ -49,7 +49,7 @@ def connection_class(config_key) # TODO: Hardcoding the uri string feels meh. Either set the database config # or reference ENV instead Knockoff.module_eval %Q{ - class #{class_name} < ActiveRecord::Base + class #{class_name} < ::ActiveRecord::Base self.abstract_class = true establish_connection :#{config_key} def self.connection_db_config From 03cb00b2210ef52cb5c8ca7b7b3e2dccddb50bbf Mon Sep 17 00:00:00 2001 From: David Kutalek Date: Fri, 16 Aug 2024 09:27:51 -0700 Subject: [PATCH 14/14] readme fix --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 482d69c..8993d39 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ A gem for easily using read replicas. ## Supported Versions | Knockoff version: | 1.0 | 1.1.0 | 1.1.1 | 1.4 | 1.5 | -| -------- | ------- | -------- | ------- | -------- | +| --- | --- | --- | --- | --- | --- | | Ruby 2.2 | [x] | [ ] | [ ] | [ ] | [ ] | | Ruby 2.3 | [x] | [x] | [ ] | [ ] | [ ] | | Ruby 2.4 | [x] | [x] | [x] | [ ] | [ ] | @@ -29,7 +29,7 @@ A gem for easily using read replicas. | Ruby 3.1 | [ ] | [ ] | [ ] | [x] | [x] | | Knockoff version: | 1.0 | 1.1.0 | 1.1.1 | 1.4 | 1.5 | -| -------- | ------- | -------- | ------- | -------- | +| --- | --- | --- | --- | --- | --- | | Rails 4 | [x] | [x] | [ ] | [ ] | [ ] | | Rails 5.0 | [x] | [x] | [x] | [ ] | [ ] | | Rails 5.1 | [x] | [x] | [x] | [ ] | [ ] |