🕵️♀️ 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 |
---|---|---|---|---|
584 | Harry Shannon | 1890-06-13 | Character actor in US films... | |
585 | Jack Nicholson | 1937-04-22 | Jack Nicholson, an American... | http://ia.media-imdb.com/im... |
430 | Avery Brooks | 1948-10-02 | Avery Franklin Brooks was b... | http://ia.media-imdb.com/im... |
431 | Elliott Gould | 1938-08-29 | Elliott Gould is an America... | http://ia.media-imdb.com/im... |
432 | Stacy Keach | 1941-06-02 | Stacy Keach has played to g... | http://ia.media-imdb.com/im... |
433 | William Russ | 1950-10-20 | Son of a naval officer; bor... | http://ia.media-imdb.com/im... |
434 | Guy Torry | 1969-01-05 | Guy Torry is a native of St... | http://ia.media-imdb.com/im... |
435 | Joe Cortese | 1948-02-22 | Mr. Cortese, a Jersey boy, ... | http://ia.media-imdb.com/im... |
id | actor_id | movie_id | name |
---|---|---|---|
440 | 397 | 31 | Léon |
441 | 76 | 31 | Stansfield |
442 | 398 | 31 | Mathilda |
443 | 399 | 31 | Tony |
444 | 400 | 31 | Malky |
445 | 401 | 31 | 1St Stansfield Man (as Will... |
446 | 402 | 31 | 2nd Stansfield man |
447 | 403 | 31 | 3rd Stansfield man (Benny) |
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