🕵️♀️ 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 |
|---|---|---|---|---|
| 75 | Maggie Gyllenhaal | 1977-11-16 | Academy Award-nominated act... | http://ia.media-imdb.com/im... |
| 76 | Gary Oldman | 1958-03-21 | Gary Oldman, the son of a w... | http://ia.media-imdb.com/im... |
| 92 | Henry Fonda | 1905-05-16 | Born in Grand Island, Nebra... | http://ia.media-imdb.com/im... |
| 93 | Joseph Sweeney | 1882-07-26 | ||
| 94 | Ed Begley | 1901-03-25 | Charismatic character star ... | http://ia.media-imdb.com/im... |
| 77 | Monique Gabriela Curnen | 1977-09-07 | Monique Gabriela Curnen is ... | http://ia.media-imdb.com/im... |
| 78 | Ron Dean | Ron Dean is a character act... | http://ia.media-imdb.com/im... | |
| 79 | Cillian Murphy | 1976-05-25 | Striking Irish actor Cillia... | http://ia.media-imdb.com/im... |
| id | actor_id | movie_id | name |
|---|---|---|---|
| 81 | 76 | 6 | Gordon |
| 82 | 2 | 6 | Lucius Fox |
| 83 | 77 | 6 | Ramirez |
| 84 | 78 | 6 | Wuertz |
| 85 | 79 | 6 | Scarecrow |
| 86 | 80 | 6 | Lau |
| 87 | 81 | 6 | Mayor |
| 88 | 82 | 6 | Maroni |
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