On Friday, April 19, 2019 at 2:09:02 AM UTC+9, shreko wrote:
>
> I tried that and while it works for the elements of the array of :job 
> records, I still have a problem not getting associated records :job_items
>
> @rs[:jobs] = Job.where(:id => [100254,100255]).eager(:job_items).all.
> to_json(include: :job_items)
>
>
Remove the all call, so it is just eager(:job_items).to_json(include: 
:job_items).  It is also possible to take an already existing array and use 
the :array option to Job.to_json, please see the json_serializer 
documentation for details on that.

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 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