🕵️♀️ Task
The count method allows us to calculate the specific number of records that exist within an ActiveRecord::Relation.
LevelUp
0.0% complete
LevelUp
0.0% complete
| id | title | year | duration | description | image | director_id |
|---|
| id | name | dob | bio | image |
|---|
| id | name | dob | bio | image |
|---|---|---|---|---|
| 236 | Margo Moorer | http://ia.media-imdb.com/im... | ||
| 246 | Gloria Foster | 1933-11-15 | Gloria Foster will always b... | http://ia.media-imdb.com/im... |
| 247 | Joe Pantoliano | 1951-09-12 | With more than 100 film, te... | http://ia.media-imdb.com/im... |
| 248 | Marcus Chong | 1967-07-08 | Marcus Chong began as a chi... | http://ia.media-imdb.com/im... |
| 249 | Julian Arahanga | 1972-12-18 | http://ia.media-imdb.com/im... | |
| 250 | Matt Doran | 1976-03-30 | http://ia.media-imdb.com/im... | |
| 251 | Belinda McClory | http://ia.media-imdb.com/im... | ||
| 252 | Anthony Ray Parker | 1958-05-13 | http://ia.media-imdb.com/im... |
| id | actor_id | movie_id | name |
|---|---|---|---|
| 273 | 247 | 19 | Cypher |
| 274 | 248 | 19 | Tank |
| 275 | 249 | 19 | Apoc |
| 276 | 250 | 19 | Mouse |
| 277 | 251 | 19 | Switch |
| 278 | 252 | 19 | Dozer |
| 279 | 253 | 19 | Agent Brown |
| 280 | 254 | 19 | Agent Jones |
Count how many records are in the customers table.
Customer.all.count
=> 327
Count how many records are in the products table.
Product.all.count
=> 183946