Serialize Product
Explore how to generate and customize serializers for the Product model in Rails. Learn to produce concise JSON outputs, modify controllers, and update tests to ensure your API data is efficiently structured and tested for best performance.
Now that we understand how the serialization gem works, it’s time to customize the product output.
Generate a serializer for the Product model
The first step is the same as what we
did in the previous lesson. We need a serializer for the Product model, so let’s create one using the command in the terminal below:
$ rails ...