🕵️♀️ 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 |
---|---|---|---|---|
390 | John McIntire | 1907-06-27 | John McIntire possessed the... | http://ia.media-imdb.com/im... |
391 | Simon Oakland | 1915-08-28 | One of the movies' most mem... | http://ia.media-imdb.com/im... |
392 | Patricia Hitchcock | 1928-07-07 | http://ia.media-imdb.com/im... | |
393 | Vaughn Taylor | 1911-02-22 | Reedy, balding, often bespe... | http://ia.media-imdb.com/im... |
394 | Lurene Tuttle | 1907-08-20 | Quite a familiar lady and n... | http://ia.media-imdb.com/im... |
395 | John Anderson | 1922-10-20 | http://ia.media-imdb.com/im... | |
396 | Mort Mills | 1919-01-11 | ||
397 | Jean Reno | 1948-07-30 | Born in Casablanca, Morocco... | http://ia.media-imdb.com/im... |
id | actor_id | movie_id | name |
---|---|---|---|
392 | 352 | 27 | Barranca / Monkey Man |
393 | 353 | 27 | Col. Musgrove |
394 | 354 | 27 | Major Eaton |
395 | 355 | 27 | Bureaucrat |
396 | 356 | 27 | Jock |
397 | 357 | 27 | Australian Climber |
398 | 358 | 28 | L.B. 'Jeff' Jefferies |
399 | 359 | 28 | Lisa Carol Fremont |
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