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
|
@ -78,9 +78,9 @@ class Announcement < ApplicationRecord
|
|||
else
|
||||
scope.select("name, custom_emoji_id, count(*) as count, exists(select 1 from announcement_reactions r where r.account_id = #{account.id} and r.announcement_id = announcement_reactions.announcement_id and r.name = announcement_reactions.name) as me")
|
||||
end
|
||||
end
|
||||
end.to_a
|
||||
|
||||
ActiveRecord::Associations::Preloader.new(records: records, associations: :custom_emoji)
|
||||
ActiveRecord::Associations::Preloader.new(records: records, associations: :custom_emoji).call
|
||||
records
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue