May 2025
Intermediate to advanced
270 pages
6h 55m
English
Sideloads allow our clients to decide the extra information they want from our endpoints on a per-need basis using a parameter. It’s optional embedding: a call to api/v1/stores/:store_id/films should not return the rentals; a call to api/v1/stores/:store_id/films?include=rentals should return the rentals in the exact same way we discussed when describing the embedded option in the previous section.
Adding this option to our current implementation is really simple. As with the exclude option, it’s something that would make sense to move out of the controller and into the presenter. Again, I leave it to you to make the refactoring. This is the minimum implementation that would work:
| | # app/controllers/api/v1/films_controller.rb ... |
Read now
Unlock full access