Search⌘ K
AI Features

Active Record Is for Database Access

Explore how Active Record serves as the fundamental database access layer in Rails applications. Understand its role in exposing data attributes, managing database interactions, and supporting your app's data model while keeping business logic separate.

We'll cover the following...

Overview

Although Rails is a Model-View-Controller (MVC) framework, the model layer in Rails is really a collection of record definitions. Models in Rails are classes that expose attributes that can be manipulated. Traditionally, those attributes come from the database and can be saved back, though we can use Active Model to create models that aren’t based on database tables.

No matter what else goes into a model class, it mostly certainly exposes attributes for manipulation, like a record ...