Typically to eager load in Rails you use the .includes(:xyz) method in the controller code (or wherever you are making the search call)

Here’s an interesting solution that does “just in time” loading based on how the view will render, eliminating the need to put includes into your AR queries.

Haven’t use it but it looks pretty cool.

https://github.com/salsify/goldiloader

By Jason

Leave a Reply

Your email address will not be published. Required fields are marked *