Hello,

I'm struggling to find a way to include eager loaded data into a dataset 
results.

I have a model definition as so :

class Foo < Sequel::Model
  many_to_one :bar, :select => [:id, :field1, :field2]
end

I'd like to automagically add an entry "bar" in foo dataset return value, 
to avoid to process all of that manually :

foo = Foo.dataset.eager(:bar)
foo.all = [
 { "id" : 1, "bar" : { "id": 32, "field1" : "value", "field2" : "value" } },
 { "id" : 2, "bar" : { "id": 41, "field1" : "value", "field2" : "value" } },
 ...
]

I didn't find how to do that with the help of sequel and i'd like to avoid 
post processing loops to do that.

And what if i have nested eager loaded data to do the same recursively ? 
like :
ber = Ber.dataset.eager(:foo => :bar)

Subsidiary question, how to do the same when i'm querying a single entry as 
Foo[id] to include the same "bar" value ?

Thanks for your help

-- 
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 http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to