Wrapping Up
In this chapter, we looked into responders to understand how they work and how to customize them. As a proof of concept, we developed two extensions for responders, one to handle flash messages and another to handle HTTP caching.
There is much more we could delegate to responders. In the HTTP layer, we could use the If-Unmodified-Since request-header to provide conditional PUT requests, wherein the resource is updated only if itâs not modified after the given date; otherwise, we return a 409 Conflict status. Figure 14, âClient and server interaction with HTTP conditional requestsâ shows this scenario.
Get Crafting Rails 4 Applications, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.