🕵️♀️ 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 |
---|---|---|---|---|
80 | Chin Han | 1969-11-27 | Named one of Asia's 25 grea... | http://ia.media-imdb.com/im... |
81 | Nestor Carbonell | 1967-12-01 | http://ia.media-imdb.com/im... | |
82 | Eric Roberts | 1956-04-18 | One of Hollywood's edgier, ... | http://ia.media-imdb.com/im... |
83 | Ritchie Coster | 1967-07-01 | http://ia.media-imdb.com/im... | |
84 | Anthony Michael Hall | 1968-04-14 | From humble showbiz beginni... | http://ia.media-imdb.com/im... |
85 | Martin Balsam | 1919-11-04 | Martin Henry Balsam was bor... | http://ia.media-imdb.com/im... |
86 | John Fiedler | 1925-02-03 | Typical of busy character a... | http://ia.media-imdb.com/im... |
87 | Lee J. Cobb | 1911-12-08 | Lee J. Cobb, one of the pre... | http://ia.media-imdb.com/im... |
id | actor_id | movie_id | name |
---|---|---|---|
89 | 83 | 6 | Chechen |
90 | 84 | 6 | Mike Engel |
91 | 85 | 7 | Juror #1 |
92 | 86 | 7 | Juror #2 |
93 | 87 | 7 | Juror #3 |
94 | 88 | 7 | Juror #4 |
95 | 89 | 7 | Juror #5 |
96 | 90 | 7 | Juror #6 |
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