From 76c894c255c21260447441c6fffcb0115ea748ae Mon Sep 17 00:00:00 2001 From: Jeremy Prevost Date: Wed, 8 Oct 2025 08:11:21 -0400 Subject: [PATCH 1/2] Rails 7.1 framework defaults https://mitlibraries.atlassian.net/browse/ETD-66 --- app/models/transfer.rb | 6 +++--- config/application.rb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/transfer.rb b/app/models/transfer.rb index 4c4fd1b9..8cac9fbc 100644 --- a/app/models/transfer.rb +++ b/app/models/transfer.rb @@ -92,10 +92,10 @@ def unassigned_files # This ensures that the activestorage objects are actually available before we update the initial files counts. # The files are not available until the after_create_commit callback so our before_save callback does not work - # for initial Transfer creation. This does mean we calculate the counts twice on creation (once with the count as - # always zero, then the initial commit, then during the after_create_commit we re-save which counts them properly). + # for initial Transfer creation. We use `update_columns` here to avoid triggering another before_save callback + # for updating the files_count and unassigned_files_count. def initial_files_count - save + update_columns(unassigned_files_count: files.count) end # This is triggered on before_save, but we must also remember to call Transfer#save to trigger this diff --git a/config/application.rb b/config/application.rb index 62eb0c25..34c93335 100644 --- a/config/application.rb +++ b/config/application.rb @@ -17,7 +17,7 @@ class Application < Rails::Application config.flipflop.raise_strategy_errors = nil # Initialize configuration defaults for originally generated Rails version. - config.load_defaults 7.0 + config.load_defaults 7.1 # Please, add to the `ignore` list any other `lib` subdirectories that do # not contain `.rb` files, or that should not be reloaded or eager loaded. From c0d9f10339d9dc0afaa6f98563e659b0c26ab19f Mon Sep 17 00:00:00 2001 From: Jeremy Prevost Date: Wed, 8 Oct 2025 09:26:43 -0400 Subject: [PATCH 2/2] Update .rubocop.yml --- .rubocop.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.rubocop.yml b/.rubocop.yml index c2c10800..f1d1ab13 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,5 +1,5 @@ AllCops: - TargetRubyVersion: 2.7 + TargetRubyVersion: 3.2 NewCops: enable StyleGuideBaseURL: https://rubystyle.guide Exclude: