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 - Ruby on Rails Tutorial
From the course: Ruby on Rails 6 Essential Training
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
Understanding ActiveRecord and ActiveRelation4m 32s
-
Using the Rails console to interact with a Rails project3m 36s
-
Create records using ActiveRecord5m 11s
-
Update records using ActiveRecord3m 53s
-
Delete records using ActiveRecord3m 18s
-
Find records using ActiveRecord6m 33s
-
Define one-to-many associations between models6m 30s
-
-
-
-