0
0
Fork 0

Extract ExportSummary class for account object counts (#32227)

This commit is contained in:
Matt Jankowski 2024-10-03 09:09:58 -04:00 committed by GitHub
parent 52afa94f1c
commit d95f6f4410
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 177 additions and 117 deletions

View file

@ -9,7 +9,7 @@ class Settings::ExportsController < Settings::BaseController
skip_before_action :require_functional!
def show
@export = Export.new(current_account)
@export_summary = ExportSummary.new(preloaded_account)
@backups = current_user.backups
end
@ -25,4 +25,15 @@ class Settings::ExportsController < Settings::BaseController
redirect_to settings_export_path
end
private
def preloaded_account
current_account.tap do |account|
ActiveRecord::Associations::Preloader.new(
records: [account],
associations: :account_stat
).call
end
end
end