
Efficient SQL preloading for your serializers
Note: I am only in Berlin until the end of June unfortunately.
When working on a bigger API Rails project, you might encounter situations where loading data to return from the API is not as trivial as simply loading a model with ActiveRecord and specifying a few includes. Even a simple case of efficiently loading only the first Photo for all Products, for example, is not trivial to implement with ActiveRecord. We will discuss a few tricks we can use in ActiveRecord itself for doing this kind of things, and then we will look at a gem which provides a nice DSL for specifying how to preload data in more complex cases.