🕵️♀️ 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 |
|---|---|---|---|---|
| 444 | Jerry Ziesmer | Grew up in Milwaukee, Wisco... | ||
| 445 | Bo Byers | |||
| 446 | James Keane | 1952-09-26 | http://ia.media-imdb.com/im... | |
| 447 | Kerry Rossall | http://ia.media-imdb.com/im... | ||
| 450 | Robert Patrick | 1958-11-05 | Robert Hammond Patrick Jr. ... | http://ia.media-imdb.com/im... |
| 451 | Earl Boen | 1945-11-07 | Veteran character actor Ear... | http://ia.media-imdb.com/im... |
| 452 | Joe Morton | 1947-10-18 | http://ia.media-imdb.com/im... | |
| 453 | S. Epatha Merkerson | 1952-11-28 | A native of Michigan, S. Ep... | http://ia.media-imdb.com/im... |
| id | actor_id | movie_id | name |
|---|---|---|---|
| 456 | 412 | 32 | Norma Desmond |
| 457 | 413 | 32 | Max Von Mayerling |
| 458 | 414 | 32 | Betty Schaefer |
| 459 | 415 | 32 | Sheldrake |
| 460 | 416 | 32 | Morino |
| 461 | 417 | 32 | Artie Green |
| 462 | 418 | 32 | Undertaker |
| 463 | 419 | 32 | 1st Finance Man (as Larry B... |
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