On Monday, June 22, 2020 at 7:39:52 AM UTC-7, shreko wrote:
>
> I tried your what you suggested, still have some issues, posting my real
> models instead of docs Artist-Albums ...
>
> @rs[:jobs] = Job.where(:id => [100254,100255]).eager(job_items: {
> job_material: :fifo}).json_serializer_opts(:include => {:job_items =>
> {:include
> => {:job_material => {:include => :fifo}}}}).all
>
> Unexpected error while processing request: undefined method
> `json_serializer_opts'
> for #<#<Class:0x0000000102d928>:0x0000000101fb48>
>
Well, it works for me:
DB.create_table(:a1s){primary_key :id}
DB.create_table(:a2s){primary_key :id; foreign_key :a1_id, :a1s}
DB.create_table(:a3s){primary_key :id; foreign_key :a2_id, :a2s}
DB.create_table(:a4s){primary_key :id; foreign_key :a3_id, :a3s}
Sequel::Model.plugin :json_serializer
class A1 < Sequel::Model; end
class A2 < Sequel::Model; end
class A3 < Sequel::Model; end
class A4 < Sequel::Model; end
A1.one_to_many :a2s
A2.one_to_many :a3s
A3.one_to_many :a4s
A4.create(:a3_id=>A3.create(:a2_id=>A2.create(:a1_id=>A1.create.id).id).id)
puts
A1.eager(:a2s=>{:a3s=>:a4s}).json_serializer_opts(:include=>{:a2s=>{:include=>{:a3s=>{:include=>:a4s}}}}).to_json
#
[{"id":1,"a2s":[{"id":1,"a1_id":1,"a3s":[{"id":1,"a2_id":1,"a4s":[{"id":1,"a3_id":1}]}]}]}]
>From the error message you are getting, maybe you are using an old version
of Sequel?
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/651bdc6c-35bb-4153-b97d-6cd2d3bb0f49o%40googlegroups.com.