Preloading associations on an Array of Objects
It might happen that your initial array of objects is not an ActiveRecord Relation. You cannot use preload on an array of objects and therefore you suffer of N+1 queries. Here is a smart way to solve the problem!
https://dev.to/coorasse/preloading-associations-on-an-array-of-objects-4d81
Post a comment