🕵️♀️ 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 |
---|---|---|---|---|
147 | David Prowse | 1935-07-01 | David "Dave" Prowse was bor... | http://ia.media-imdb.com/im... |
148 | Peter Mayhew | 1944-05-19 | Peter Mayhew was born on Ma... | http://ia.media-imdb.com/im... |
149 | Kenny Baker | 1934-08-24 | http://ia.media-imdb.com/im... | |
150 | Frank Oz | 1944-05-25 | http://ia.media-imdb.com/im... | |
242 | Keanu Reeves | 1964-09-02 | Keanu Reeves, whose first n... | http://ia.media-imdb.com/im... |
243 | Laurence Fishburne | 1961-07-30 | Born in Augusta, Georgia on... | http://ia.media-imdb.com/im... |
151 | Alec Guinness | 1914-04-02 | Alec Guinness de Cuffe was ... | http://ia.media-imdb.com/im... |
152 | Jeremy Bulloch | 1945-02-16 | Jeremy Bulloch was born on ... |
id | actor_id | movie_id | name |
---|---|---|---|
161 | 155 | 11 | Snow Creature |
162 | 156 | 11 | Emperor (voice) |
163 | 157 | 12 | The Ring (voice) |
164 | 158 | 12 | Frodo Baggins |
165 | 112 | 12 | Everard Proudfoot |
166 | 114 | 12 | Samwise 'Sam' Gamgee |
167 | 159 | 12 | Sauron |
168 | 117 | 12 | Boromir |
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