Fix N+1s because of association preloaders not actually getting called (#28339)
This commit is contained in:
		@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user