Given the simple association of Author and Book as many_to_one in Sequel,
I'm trying to generate a json output of the form:
authors =>
[
{ :id => 1,
:book_ids => [1, 2, 3]
},
{ :id => 2,
:book_ids => [4, 5]
}
]
Using the Sequel models, I think this would be something like this:
Authors.all.to_json( :include => { :books => { :only => :id } ) )
However, I am trying to do it with only raw datasets. (The reason is that
the database and hence models can change, so I would have to create and
destroy the Model classes dynamically. The details of the associations are
held in a separate database.)
Is there a way this result be built manually?
Or can I define the association on the dataset without using models.
Any help much appreciated.
Nick
--
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.