From 2bb215f713d1ec224dce44279c427dcb403fbda8 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Thu, 29 Feb 2024 15:21:08 -0600 Subject: [PATCH 1/2] Document children: use update! and return true if loop doesn't raise --- app/models/document_access.rb | 4 +++- app/models/document_download.rb | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/models/document_access.rb b/app/models/document_access.rb index 631d1c21..451b9abf 100644 --- a/app/models/document_access.rb +++ b/app/models/document_access.rb @@ -15,8 +15,9 @@ def self.import(file) ::CSV.foreach(file.path, headers: true) do |row| logger.debug("CSV Row: #{row.to_hash}") document_access = DocumentAccess.find_or_initialize_by(friendlier_id: row[0], institution_code: row[1]) - document_access.update(row.to_hash) + document_access.update!(row.to_hash) end + true end def self.destroy_all(file) @@ -25,6 +26,7 @@ def self.destroy_all(file) logger.debug("CSV Row: #{row.to_hash}") DocumentAccess.destroy_by(id: row[0], friendlier_id: row[1]) end + true end def to_csv diff --git a/app/models/document_download.rb b/app/models/document_download.rb index b6471976..a5bf3f7d 100644 --- a/app/models/document_download.rb +++ b/app/models/document_download.rb @@ -15,8 +15,9 @@ def self.import(file) ::CSV.foreach(file.path, headers: true) do |row| logger.debug("CSV Row: #{row.to_hash}") document_download = DocumentDownload.find_or_initialize_by(friendlier_id: row[0], label: row[1], value: row[2]) - document_download.update(row.to_hash) + document_download.update!(row.to_hash) end + true end def self.destroy_all(file) @@ -25,6 +26,7 @@ def self.destroy_all(file) logger.debug("CSV Row: #{row.to_hash}") DocumentDownload.destroy_by(id: row[0], friendlier_id: row[1]) end + true end def to_csv From afdf1056faf712bc8ffb242a6222f5447cb7e03f Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Thu, 29 Feb 2024 15:22:20 -0600 Subject: [PATCH 2/2] Gems: minitest to 7.0 --- geoblacklight_admin.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geoblacklight_admin.gemspec b/geoblacklight_admin.gemspec index b513bf71..eb7e2716 100644 --- a/geoblacklight_admin.gemspec +++ b/geoblacklight_admin.gemspec @@ -56,7 +56,7 @@ Gem::Specification.new do |s| s.add_development_dependency "m", "~> 1.5" s.add_development_dependency "minitest", "~> 5.18" s.add_development_dependency "minitest-ci", "~> 3.4" - s.add_development_dependency "minitest-rails", "~> 6.1" + s.add_development_dependency "minitest-rails", "~> 7.0" s.add_development_dependency "minitest-reporters", "~> 1.6" s.add_development_dependency "rspec-rails", "~> 3.0" s.add_development_dependency "selenium-webdriver"