Using an objet to represent a complex preload
27-Aug-2021 2495
Sometimes just using preload or includes is not possible… or maybe it is, but you just can’t figure it out how to do it.Maybe you want to preload some records matching two keys, or preload a grouped relation.Maybe you know how to represent the association with a has_many :through, but you need something faster, or to use less memory.In that kind of situations, one thing that you can do is to write a custom object to represent that preload.Here I will try to explain how and when you can do it with an example.
Using an objet to represent a complex preload #ruby #rubydeveloper #rubyonrails #Using #objet #represent #complex #preload https://rubyonrails.ba/link/using-an-objet-to-represent-a-complex-preload