Extract ExportSummary
class for account object counts (#32227)
This commit is contained in:
parent
52afa94f1c
commit
d95f6f4410
6 changed files with 177 additions and 117 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue