🕵️♀️ 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 |
|---|---|---|---|---|
| 436 | Jason Bose Smith | |||
| 437 | Antonio David Lyons | http://ia.media-imdb.com/im... | ||
| 438 | Alex Sol | http://ia.media-imdb.com/im... | ||
| 439 | Martin Sheen | 1940-08-03 | Multiple Emmy and Golden Gl... | http://ia.media-imdb.com/im... |
| 440 | Frederic Forrest | 1936-12-23 | Frederic Forrest, the Oscar... | http://ia.media-imdb.com/im... |
| 441 | Sam Bottoms | 1955-10-17 | http://ia.media-imdb.com/im... | |
| 442 | Albert Hall | 1937-11-10 | Albert P. Hall was born Nov... | http://ia.media-imdb.com/im... |
| 443 | Dennis Hopper | 1936-05-17 | Multi-talented and unconven... | http://ia.media-imdb.com/im... |
| id | actor_id | movie_id | name |
|---|---|---|---|
| 448 | 404 | 31 | 4th Stansfield man |
| 449 | 405 | 31 | Mathilda's Father |
| 450 | 406 | 31 | Mathilda's Mother |
| 451 | 407 | 31 | Mathilda's Sister |
| 452 | 408 | 31 | Mathilda's Brother |
| 453 | 409 | 31 | Fatman |
| 454 | 410 | 31 | Tonto (as Lucius Wyatt 'Che... |
| 455 | 411 | 32 | Joe Gillis |
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