salsify / goldiloader

Just the right amount of Rails eager loading
MIT License
1.61k stars 53 forks source link

Implement custom preloads #129

Closed apauly closed 1 year ago

apauly commented 1 year ago

Referenced Issue: #128

This PR implements the idea that I outlined in the mentioned issue. I was thinking of moving the logic into its own class (e.g. auto_include_context.custom_preloads.some_method), but that would require to also pass the @models to that instance. So I ended up including the logic in the AutoIncludeContext to keep the memory footprint as low as possible.

Refer to the Readme changes for usage instructions. Please let me know if there's anything should be adjusted (code styling etc.).

apauly commented 1 year ago

Are there any chances that this (as soon as it got merged) could get backported to the 4-x-stable branch in order to use it with Ruby 2.7? Please let me know if there's anything I could do to support that