Hi Jeremy,

I see you've written in the past that there isn't much use in eager-loading 
relationships on single models. I have a case where I am retrieving a 
single object but it has a tree of one-to-many relationships hanging off of 
it. (I am sideloading related records for a json:api payload.) In this 
case, it would make sense to eager load the relationships, otherwise the 
serializer causes Sequel to fire off a query for each element of the tree 
as it enumerates through the relationships.

Short of doing something like dataset.eager(foo).where(:id => 
bar).all.first, is there any way to use Sequel::Dataset#eager with 
#first/first! and #with_pk/with_pk!? If it can't be added to Sequel, how 
might I go about writing a plugin to enable this behavior?

Thank you in advance,

Mike

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to