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.

images/6_conditional_put.png
Figure 14. Client and server ...

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.