Thanks Jeremy for your generous help. I am getting closer but still not
there
I tried:
@rs[:jobs] = Job.where(:id => [100254,100255]).eager(:job_items).all
@rs[:jobs].each{|job| job.json_serializer_opts = {include: :job_items}}
and got the following error:
Unexpected error while processing request: undefined method
`json_serializer_opts='
for #<Job:0x0000000405a0d8>
Did you mean? json_serializer_opts
Thanks again.
On Monday, 20 April 2020 12:20:15 UTC-6, Jeremy Evans wrote:
>
> On Monday, April 20, 2020 at 8:54:09 AM UTC-7, shreko wrote:
>>
>> To be more precise, simple models work, what doesn't work are Eager
>> models.
>>
>> @rs[:jobs] = Job.where(:id => [100,101]).eager(:job_items).all
>>
>>
>>
>> I get the jobs, but not the job_items.
>>
>
> This is expected. Dataset#eager does not change JSON output. You can
> probably do:
>
> @rs[:jobs].each{|job| job.json_serializer_opts = {include: :job_items}}
>
> This will change the JSON serialization output to include the job items.
>
> 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/3e19ddee-3d02-428a-a215-593593cd180c%40googlegroups.com.