6

Data Layer Abstractions

This chapter opens Part 2 of the book, in which we will talk about the particular patterns in extracting abstraction layers. As we discussed in Part 1, growing Rails applications feel too cramped within model-controller-view boundaries; introducing new abstractions allows your code to breathe freely. We start with the Rails model layer and its core component—Active Record.

In Chapter 2, Active Models and Records, we learned that Active Record models are by design responsible for representing domain objects and communicating with the persistence engine. In this chapter, we will discuss the techniques for reducing the responsibility of Active Record by introducing new abstraction layers. First, we will discuss how to ...

Get Layered Design for Ruby on Rails Applications 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.