RubyFlow The Ruby and Rails community linklog


The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

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!

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in