From the course: Ruby on Rails 6 Essential Training

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Understanding ActiveRecord and ActiveRelation

Understanding ActiveRecord and ActiveRelation - Ruby on Rails Tutorial

From the course: Ruby on Rails 6 Essential Training

Start my 1-month free trial

Understanding ActiveRecord and ActiveRelation

- [Instructor] In this chapter we're going to be talking about models and ActiveRecord and we'll start by learning about ActiveRecord and ActiveRelation. If you think back to that MVC web architecture diagram, we've now looked at all of the parts that are there except for the model. In the last chapter we generated a model with generated a corresponding database table at the same time but we haven't actually talked about how the models work. So that's what we're going to do in this chapter. And to do that we need to first understand ActiveRecord. When you see active record as two words and all lowercase it's a design pattern for relational databases and it's not unique to Ruby on Rails. Other programming languages use the active record design pattern as well. When Ruby on Rails implements that design pattern we call it ActiveRecord all run together with a capital A and R. ActiveRecord allows us to retrieve and…

Contents