Skip to content

Commit 76c894c

Browse files
committed
1 parent d8fbf03 commit 76c894c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

app/models/transfer.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ def unassigned_files
9292

9393
# This ensures that the activestorage objects are actually available before we update the initial files counts.
9494
# The files are not available until the after_create_commit callback so our before_save callback does not work
95-
# for initial Transfer creation. This does mean we calculate the counts twice on creation (once with the count as
96-
# always zero, then the initial commit, then during the after_create_commit we re-save which counts them properly).
95+
# for initial Transfer creation. We use `update_columns` here to avoid triggering another before_save callback
96+
# for updating the files_count and unassigned_files_count.
9797
def initial_files_count
98-
save
98+
update_columns(unassigned_files_count: files.count)
9999
end
100100

101101
# This is triggered on before_save, but we must also remember to call Transfer#save to trigger this

config/application.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Application < Rails::Application
1717
config.flipflop.raise_strategy_errors = nil
1818

1919
# Initialize configuration defaults for originally generated Rails version.
20-
config.load_defaults 7.0
20+
config.load_defaults 7.1
2121

2222
# Please, add to the `ignore` list any other `lib` subdirectories that do
2323
# not contain `.rb` files, or that should not be reloaded or eager loaded.

0 commit comments

Comments
 (0)