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
|
@ -111,7 +111,7 @@ class Notification < ApplicationRecord
|
|||
|
||||
# Instead of using the usual `includes`, manually preload each type.
|
||||
# If polymorphic associations are loaded with the usual `includes`, other types of associations will be loaded more.
|
||||
ActiveRecord::Associations::Preloader.new(records: grouped_notifications, associations: associations)
|
||||
ActiveRecord::Associations::Preloader.new(records: grouped_notifications, associations: associations).call
|
||||
end
|
||||
|
||||
unique_target_statuses = notifications.filter_map(&:target_status).uniq
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue