From the course: Ruby on Rails 5 Essential Training
Unlock the full course today
Join today to access over 22,700 courses taught by industry experts or purchase this course individually.
ActiveRecord and ActiveRelation - Ruby on Rails Tutorial
From the course: Ruby on Rails 5 Essential Training
ActiveRecord and ActiveRelation
- [Narrator] ActiveRecord and ActiveRelation are part of the Rails framework that's going to power our models. So before we begin coding on our models let's get a big picture understanding of how they work. Active record, when it's written all lowercase as two separate words refers to a commonly used design pattern for working with relational databases. It's not Rail specific. You could use the active record pattern in any programming language. It's an approach to designing object oriented software. ActiveRecord, when it's written as one word with a capital A and R, refers to the Rails implementation of the active record pattern. Often you can use the terms interchangeably but it's helpful to understand the context and to know the difference. The ActiveRecord design pattern allows you to retrieve database data as objects. And then to work with them in an object oriented way. Not just as static rows of data. If you've ever worked with database data as rows you know it can be…
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
-
-
-
-
-
-
-
(Locked)
ActiveRecord and ActiveRelation4m 32s
-
(Locked)
Model naming5m 52s
-
(Locked)
Model attributes2m 51s
-
(Locked)
The Rails console3m 17s
-
(Locked)
Create records4m 53s
-
(Locked)
Update records3m 16s
-
(Locked)
Delete records2m 29s
-
(Locked)
Find records5m 48s
-
(Locked)
Query methods: Conditions7m 39s
-
(Locked)
Query methods: Order, limit, and offset6m 29s
-
(Locked)
Named scopes8m 26s
-
(Locked)
-
-
-
-
-
-
-
-
-
-
-