TypeFast
[ Ссылка ]
In this video, I go over two different ways to preload associations to avoid N+1 queries.
The first is the classic eager loading method that everyone is probably familiar with, which is calling ".includes" on an ActiveRecord Relation collection.
The second is utilizing an ActiveRecord class to preload associations in an array of ActiveRecord objects where ".includes" method does not work.
Ещё видео!