🕵️♀️ 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 |
---|---|---|---|---|
348 | Denholm Elliott | 1922-05-31 | Much-loved character actor ... | http://ia.media-imdb.com/im... |
373 | Lionel Barrymore | 1878-04-28 | Famed actor, composer, arti... | http://ia.media-imdb.com/im... |
343 | Christine Estabrook | 1952-09-13 | Veteran actress Christine E... | http://ia.media-imdb.com/im... |
344 | Karen Allen | 1951-10-05 | Born in rural southern Illi... | http://ia.media-imdb.com/im... |
345 | Paul Freeman | 1943-01-18 | One of Britain's most versa... | http://ia.media-imdb.com/im... |
346 | Ronald Lacey | 1935-09-28 | Ronald Lacey was born on Ju... | |
347 | John Rhys-Davies | 1944-05-05 | Acclaimed British actor Joh... | http://ia.media-imdb.com/im... |
370 | Irene Winston | 1916-07-18 |
id | actor_id | movie_id | name |
---|---|---|---|
344 | 92 | 24 | Frank |
345 | 307 | 24 | Cheyenne |
346 | 308 | 24 | Harmonica |
347 | 309 | 24 | Morton - Railroad Baron |
348 | 310 | 24 | Sam |
349 | 311 | 24 | Stony - Member of Frank's Gang |
350 | 312 | 24 | Snaky - Member of Frank's Gang |
351 | 313 | 24 | Sheriff - Auctioneer |
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