Fix N+1s because of association preloaders not actually getting called (#28339)
This commit is contained in:
parent
3f1ec16377
commit
dcc24db793
7 changed files with 12 additions and 12 deletions
|
@ -86,8 +86,8 @@ class InitialStateSerializer < ActiveModel::Serializer
|
|||
|
||||
ActiveRecord::Associations::Preloader.new(
|
||||
records: [object.current_account, object.admin, object.owner, object.disabled_account, object.moved_to_account].compact,
|
||||
associations: [:account_stat, :user, { moved_to_account: [:account_stat, :user] }]
|
||||
)
|
||||
associations: [:account_stat, { user: :role, moved_to_account: [:account_stat, { user: :role }] }]
|
||||
).call
|
||||
|
||||
store[object.current_account.id.to_s] = serialized_account(object.current_account) if object.current_account
|
||||
store[object.admin.id.to_s] = serialized_account(object.admin) if object.admin
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue