For classic example of Eager loading fom docs:

Artist.one_to_many :albums
Album.one_to_many :tracks
Tracks.many_to_one :lyric


artists = Artist.eager(albums: {tracks: :lyric})


In order to get full data structure json, is there a way to write 
json_serializer_opts a bit more concise than the following 

artists.each do |artist| 
  artist.json_serializer_opts(include: :albums)
        
  artist.albums.each do |album|
    album.json_serializer_opts(include: :tracks)
         
    album.tracks.each do |track|
      track.json_serializer_opts(include: :lyric)
    end            
       
  end
end

Thanks




-- 
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/b90f9158-ba9c-4a1f-b169-261df3cd437eo%40googlegroups.com.

Reply via email to