Extract ExportSummary class for account object counts (#32227)

This commit is contained in:
Matt Jankowski authored and GitHub committed 2024-10-03 13:09:58 +00:00
1 parent 52afa94f1c
commit d95f6f4410
6 files changed
+177 -117

No files matched your search

+12 -1
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