🕵️♀️ 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 |
|---|---|---|---|---|
| 123 | Marton Csokas | 1966-06-30 | Marton became an actor in 1... | http://ia.media-imdb.com/im... |
| 124 | Richard Edge | |||
| 125 | Jason Fitch | |||
| 126 | Bernard Hill | 1944-12-17 | http://ia.media-imdb.com/im... | |
| 127 | Edward Norton | 1969-08-18 | Edward Norton was born on A... | http://ia.media-imdb.com/im... |
| 128 | Brad Pitt | 1963-12-18 | An actor and producer known... | http://ia.media-imdb.com/im... |
| 129 | Helena Bonham Carter | 1966-05-26 | Helena Bonham Carter, the y... | http://ia.media-imdb.com/im... |
| 130 | Meat Loaf | 1947-09-27 | Meat Loaf was born in Texas... | http://ia.media-imdb.com/im... |
| id | actor_id | movie_id | name |
|---|---|---|---|
| 137 | 131 | 10 | Richard Chesler |
| 138 | 132 | 10 | Intern |
| 139 | 133 | 10 | Thomas |
| 140 | 134 | 10 | Group Leader |
| 141 | 135 | 10 | Weeping Woman |
| 142 | 136 | 10 | Group Leader |
| 143 | 137 | 10 | Speaker |
| 144 | 138 | 10 | Chloe |
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