🕵️♀️ 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 |
---|---|---|---|---|
183 | Tom Hardy | 1977-09-15 | With his breakthrough perfo... | http://ia.media-imdb.com/im... |
270 | Jefechander Suplino | |||
184 | Ken Watanabe | 1959-10-21 | Both of Ken Watanabe's pare... | http://ia.media-imdb.com/im... |
185 | Dileep Rao | 1973-07-29 | http://ia.media-imdb.com/im... | |
186 | Tom Berenger | 1949-05-31 | Born in Chicago, Illinois, ... | http://ia.media-imdb.com/im... |
187 | Marion Cotillard | 1975-09-30 | Academy Award-winning Frenc... | http://ia.media-imdb.com/im... |
188 | Pete Postlethwaite | 1946-02-07 | An odd-looking but quite fa... | http://ia.media-imdb.com/im... |
189 | Lukas Haas | 1976-04-16 | Lukas was born on April 16,... | http://ia.media-imdb.com/im... |
id | actor_id | movie_id | name |
---|---|---|---|
201 | 187 | 14 | Mal |
202 | 188 | 14 | Maurice Fischer |
203 | 74 | 14 | Miles |
204 | 189 | 14 | Nash |
205 | 190 | 14 | Tadashi |
206 | 191 | 14 | Phillipa (3 years) |
207 | 192 | 14 | James (20 months) |
208 | 31 | 15 | James Conway |
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