Thank you Jeremy, it works. Thanks for being patient with my lack of 
knowledge in this matter.

I am wondering if there may be a better way to query Eager relationships in 
a way that would strip out Model thing and output just arrays of hashes or 
to_hash_groups just like when calling .all on a dataset like 

DB["select * from jobs join job_items ..."].all


Thanks.

On Monday, 20 April 2020 13:10:06 UTC-6, Jeremy Evans wrote:
>
> On Monday, April 20, 2020 at 11:54:37 AM UTC-7, shreko wrote:
>>
>> 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
>>
>>
> As the error message indicates, I made a mistake.  The method takes the 
> options, there is no separate setter method, so you would need:
>
>    @rs[:jobs].each{|job| job.json_serializer_opts(include: :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/26bf0972-8c66-45df-a324-17cc0730cc20%40googlegroups.com.

Reply via email to