From 7964466d4f63bb5f0de2ca9675a01e27beeb0db3 Mon Sep 17 00:00:00 2001 From: Rob Kaufman Date: Thu, 8 Feb 2024 01:04:23 -0800 Subject: [PATCH 1/5] Found another place we need to include the monad lib. This time so that generators work --- spec/test_app/config/application.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/test_app/config/application.rb b/spec/test_app/config/application.rb index af0ed0959..bb6896ceb 100644 --- a/spec/test_app/config/application.rb +++ b/spec/test_app/config/application.rb @@ -11,6 +11,7 @@ require "action_cable/engine" # require "rails/test_unit/railtie" require "sprockets/railtie" +require 'dry/monads' Bundler.require(*Rails.groups) require "bulkrax" From 166e212024470522eb1e8b778fa51853cb6ed412 Mon Sep 17 00:00:00 2001 From: Rob Kaufman Date: Thu, 8 Feb 2024 22:10:22 -0800 Subject: [PATCH 2/5] rails 5 does not have pick, fixes latest status check --- app/models/bulkrax/status.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/models/bulkrax/status.rb b/app/models/bulkrax/status.rb index 534f176f0..1cf21d559 100644 --- a/app/models/bulkrax/status.rb +++ b/app/models/bulkrax/status.rb @@ -23,7 +23,12 @@ def self.latest_by_statusable_subtable end def latest? - self.id == self.class.where(statusable_id: self.statusable_id, statusable_type: self.statusable_type).order('id desc').pick(:id) + # TODO: remove if statment when we stop supporting Hyrax < 4 + self.id == if Gem::Version.new(Rails::VERSION) >= Gem::Version.new('6.0.0') + self.class.where(statusable_id: self.statusable_id, statusable_type: self.statusable_type).order('id desc').pick(:id) + else + self.class.where(statusable_id: self.statusable_id, statusable_type: self.statusable_type).order('id desc').pluck(:id).first + end end end end From 83b3237dd624cbf6ae852d29cf1d4e7369617131 Mon Sep 17 00:00:00 2001 From: Rob Kaufman Date: Thu, 8 Feb 2024 22:13:37 -0800 Subject: [PATCH 3/5] call the cops --- app/models/bulkrax/status.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/bulkrax/status.rb b/app/models/bulkrax/status.rb index 1cf21d559..e9411f0cc 100644 --- a/app/models/bulkrax/status.rb +++ b/app/models/bulkrax/status.rb @@ -27,7 +27,7 @@ def latest? self.id == if Gem::Version.new(Rails::VERSION) >= Gem::Version.new('6.0.0') self.class.where(statusable_id: self.statusable_id, statusable_type: self.statusable_type).order('id desc').pick(:id) else - self.class.where(statusable_id: self.statusable_id, statusable_type: self.statusable_type).order('id desc').pluck(:id).first + self.class.where(statusable_id: self.statusable_id, statusable_type: self.statusable_type).order('id desc').pluck(:id).first # rubocop:disable Rails/Pic end end end From 2e2b899e5618c037b24706a48d9d826326639d4a Mon Sep 17 00:00:00 2001 From: Rob Kaufman Date: Thu, 8 Feb 2024 23:33:44 -0800 Subject: [PATCH 4/5] typo --- app/models/bulkrax/status.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/bulkrax/status.rb b/app/models/bulkrax/status.rb index e9411f0cc..a0e385a5f 100644 --- a/app/models/bulkrax/status.rb +++ b/app/models/bulkrax/status.rb @@ -27,7 +27,7 @@ def latest? self.id == if Gem::Version.new(Rails::VERSION) >= Gem::Version.new('6.0.0') self.class.where(statusable_id: self.statusable_id, statusable_type: self.statusable_type).order('id desc').pick(:id) else - self.class.where(statusable_id: self.statusable_id, statusable_type: self.statusable_type).order('id desc').pluck(:id).first # rubocop:disable Rails/Pic + self.class.where(statusable_id: self.statusable_id, statusable_type: self.statusable_type).order('id desc').pluck(:id).first # rubocop:disable Rails/Pick end end end From d82541cc39d4de5b66d36262abc503d0f459f397 Mon Sep 17 00:00:00 2001 From: Rob Kaufman Date: Fri, 9 Feb 2024 00:08:56 -0800 Subject: [PATCH 5/5] fix version string --- app/models/bulkrax/status.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/bulkrax/status.rb b/app/models/bulkrax/status.rb index a0e385a5f..86c850b0f 100644 --- a/app/models/bulkrax/status.rb +++ b/app/models/bulkrax/status.rb @@ -24,7 +24,7 @@ def self.latest_by_statusable_subtable def latest? # TODO: remove if statment when we stop supporting Hyrax < 4 - self.id == if Gem::Version.new(Rails::VERSION) >= Gem::Version.new('6.0.0') + self.id == if Gem::Version.new(Rails::VERSION::STRING) >= Gem::Version.new('6.0.0') self.class.where(statusable_id: self.statusable_id, statusable_type: self.statusable_type).order('id desc').pick(:id) else self.class.where(statusable_id: self.statusable_id, statusable_type: self.statusable_type).order('id desc').pluck(:id).first # rubocop:disable Rails/Pick