🕵️♀️ 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 |
---|---|---|---|---|
420 | Charles Dayton | |||
421 | Cecil B. DeMille | 1881-08-12 | His parents Henry C. DeMill... | http://ia.media-imdb.com/im... |
422 | Hedda Hopper | 1885-05-02 | Her father was a butcher. I... | http://ia.media-imdb.com/im... |
423 | Buster Keaton | 1895-10-04 | When, at six months, he tum... | http://ia.media-imdb.com/im... |
424 | Anna Q. Nilsson | 1888-03-30 | Anna Quirentia Nilsson, pop... | |
425 | Edward Furlong | 1977-08-02 | http://ia.media-imdb.com/im... | |
426 | Beverly D'Angelo | 1951-11-15 | Intriguing, inspiring, and ... | http://ia.media-imdb.com/im... |
519 | Michael Chiklis | 1963-08-30 | Educated at Boston Universi... | http://ia.media-imdb.com/im... |
id | actor_id | movie_id | name |
---|---|---|---|
432 | 390 | 30 | Sheriff Al Chambers |
433 | 391 | 30 | Dr. Fred Richman |
434 | 381 | 30 | Tom Cassidy |
435 | 392 | 30 | Caroline (as Pat Hitchcock) |
436 | 393 | 30 | George Lowery |
437 | 394 | 30 | Mrs. Chambers |
438 | 395 | 30 | California Charlie |
439 | 396 | 30 | Highway Patrol Officer |
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