Книга: Metaprogramming Ruby 2
Назад: The Rails Source Code
Дальше: A Short Active Record Example

Chapter 9

The Design of Active Record

Active Record is the library in Rails that maps Ruby objects to database records. This functionality is called object-relational mapping, and it allows you to get the best of both the relational database (used for persistence) and object-oriented programming (used for business logic).

In this chapter, as well as the next two, we’ll take a look at the high-level design of Active Record’s source code and how its pieces fit together. We are less interested in what Active Record does than how it does it. All we need is a very short example of mapping a class to a database—just enough to kickstart our exploration of Active Record’s internals.

Назад: The Rails Source Code
Дальше: A Short Active Record Example