Skip to content
Discussion options

You must be logged in to vote

Hey! 👋

Is there a built-in, idiomatic way to eager-load child rows for MTI from the parent side to avoid N+1?
Regarding join(:concert_event):
Is there a way to include multiple child joins at once (e.g., join(:concert_event, :workshop_event)) and have the framework recognize and hydrate those so that calling event.concert_event / event.workshop_event does not perform additional queries?

What you were trying to do in one of your examples (joining all the needed child reverse relations) should work in theory:

events = Event.all.join(:concert_event, :workshop_event)

Unfortunately, this doesn't work right now. 😢 The fact that it doesn't is certainly not intended and should be fixed.

EDIT: f…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by treagod
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants