it’s a common situation when one loading model service used in many places, and for different places, you don’t need to preload some relations which is clearly needed in some other places

Well, memory is also limited. I would make a service to accept a parameter with an associations list in the rails native format and pass it through the call.


Years ago when I was writing some Rails, I extended rails_panel as described here; I have no idea if it still works, but you may find it interesting to tweak the code and/or use these extensions as is.

Only those users with full accounts are able to leave comments. Log in, please.