From 2cd541dca6a468adb7ea9a78caf9ce14e4bedfa4 Mon Sep 17 00:00:00 2001 From: Adam Stegman Date: Fri, 15 Dec 2023 21:06:53 +0000 Subject: [PATCH 1/2] Fix NameError from nulldb nulldb is only loaded in the tests, so using its names in library code raised an exception: ``` NameError: uninitialized constant ActiveRecord::ConnectionAdapters::NullDBAdapter ``` We can instead key off the method that nulldb doesn't implement to fix the same issue as #32. --- lib/acts_as_scrubbable/ar_class_processor.rb | 2 +- lib/acts_as_scrubbable/task_runner.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/acts_as_scrubbable/ar_class_processor.rb b/lib/acts_as_scrubbable/ar_class_processor.rb index 1faa0da..36c805e 100644 --- a/lib/acts_as_scrubbable/ar_class_processor.rb +++ b/lib/acts_as_scrubbable/ar_class_processor.rb @@ -28,7 +28,7 @@ def process(num_of_batches) end ActsAsScrubbable.logger.info Term::ANSIColor.blue("#{scrubbed_count} #{ar_class} objects scrubbed") - ActiveRecord::Base.connection.verify! unless ActiveRecord::Base.connection.is_a?(ActiveRecord::ConnectionAdapters::NullDBAdapter) + ActiveRecord::Base.connection.verify! if ActiveRecord::Base.connection.respond_to?(:reconnect) ActsAsScrubbable.logger.info Term::ANSIColor.white("Scrub Complete!") end diff --git a/lib/acts_as_scrubbable/task_runner.rb b/lib/acts_as_scrubbable/task_runner.rb index 3c6e9f6..98b8ef4 100644 --- a/lib/acts_as_scrubbable/task_runner.rb +++ b/lib/acts_as_scrubbable/task_runner.rb @@ -55,7 +55,7 @@ def scrub(num_of_batches: nil, skip_before_hooks: false, skip_after_hooks: false Parallel.each(ar_classes) do |ar_class| ActsAsScrubbable::ArClassProcessor.new(ar_class).process(num_of_batches) end - ActiveRecord::Base.connection.verify! unless ActiveRecord::Base.connection.is_a?(ActiveRecord::ConnectionAdapters::NullDBAdapter) + ActiveRecord::Base.connection.verify! if ActiveRecord::Base.connection.respond_to?(:reconnect) after_hooks unless skip_after_hooks end From ee79b823c7da4fba623b0cd8e5f3e1ae361b4876 Mon Sep 17 00:00:00 2001 From: Adam Stegman Date: Fri, 15 Dec 2023 15:20:22 -0600 Subject: [PATCH 2/2] v2.1.3 --- lib/acts_as_scrubbable/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/acts_as_scrubbable/version.rb b/lib/acts_as_scrubbable/version.rb index b656e41..10a41e1 100644 --- a/lib/acts_as_scrubbable/version.rb +++ b/lib/acts_as_scrubbable/version.rb @@ -1,3 +1,3 @@ module ActsAsScrubbable - VERSION = '2.1.2' + VERSION = '2.1.3' end