Active Models and Records
In this chapter, we will dig deeper into the model layer of web applications and how it is implemented in Rails. The model layer, in a broad sense, is where the actual business logic of the application lives. If the database is the heart of a web application, the model is its life-blood system. Thus, it requires your careful attention.
We will learn about the components Rails provides to build the model layer. First, we’ll take a quick look at a basic Active Record model and examine its responsibilities, from persistence to whatever you can imagine. Then, we’ll discuss the role of Active Model and how it could be useful on its own. Finally, we’ll talk about the phenomenon of God objects and how it relates to Active Record.
We will cover the following topics:
- Active Record overview: persistence and beyond
- Active Model: the hidden gem behind Active Record
- Seeking God objects
This chapter aims to familiarize you...