Crafting the Notifications Layer
In this chapter, we will touch on the topic of user notifications and how to organize the corresponding code in a Rails application. We will start by discussing the built-in abstraction for sending emails—Action Mailer. Then, we will demonstrate how adding notification channels increases the code base’s complexity and how we can tackle this complexity by introducing a new abstraction layer (with and without third-party libraries). Finally, we will talk about the part of the domain model responsible for managing notifications.
We will cover the following topics:
- From Action Mailer to multiple notification channels
- Extracting the notifications layer
- Modeling user notification preferences
This chapter aims to familiarize you with the idea of the notifications layer and how it improves the maintainability of applications relying on different communication channels.