Thank you Jeremy,

I can confirm that Dataset#to_json works on 4.48

@rs[:jobs] = Job.where(:id => [100254,100255]).eager(job_items: {
job_material: :fifo}).to_json(:include => {:job_items => {:include => 
{:job_material 
=> {:include => :fifo}}}})

but I would prefer to use json_serializer_opts to delay json serialization 
until whole @rs is sent back to client as part of roda's :json plugin

plugin :json, :classes => [Array, Hash, Sequel::Model]


Thanks.

On Monday, 22 June 2020 12:57:22 UTC-6, Jeremy Evans wrote:
>
> On Monday, June 22, 2020 at 9:51:07 AM UTC-7, shreko wrote:
>>
>> Yes, in this particular application we are using sequel 4.48.
>> I will try this later in a new app that I am working on.
>> Jeremy, thank you very much for your help and support. Solutions like 
>> this will greatly simplify code when dealing with deeply nested model which 
>> we have  a lot.
>>
>
> Dataset#json_serializer_opts wasn't added until Sequel 5.29.
>
> For older versions, I think you can call Dataset#to_json with an :array 
> option of the objects you want to serialize, and the :include option 
> specifying how to handle nested associations.
>
> Thanks,
> Jeremy
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/75b8bb8a-a1b0-404d-8893-e3bfc85838d9o%40googlegroups.com.

Reply via email to