🕵️♀️ Task
The find
method searches for a row/record by it’s primary key (conventionally named id
). The find
method requires an argument that will be used to look up the object from the table.
LevelUp
0.0% complete
LevelUp
0.0% complete
id | title | year | duration | description | image | director_id |
---|---|---|---|---|---|---|
33 | American History X | 1998 | 119 | A former neo-nazi skinhead ... | http://ia.media-imdb.com/im... | 25 |
34 | Apocalypse Now | 1979 | 153 | During the U.S.-Viet Nam Wa... | http://ia.media-imdb.com/im... | 2 |
35 | Terminator 2: Judgment Day | 1991 | 137 | The cyborg who once tried t... | http://ia.media-imdb.com/im... | 26 |
36 | Memento | 2000 | 113 | A man, suffering from short... | http://ia.media-imdb.com/im... | 5 |
37 | Saving Private Ryan | 1998 | 169 | Following the Normandy Land... | http://ia.media-imdb.com/im... | 7 |
38 | City Lights | 1931 | 87 | The Tramp struggles to help... | http://ia.media-imdb.com/im... | 27 |
39 | Dr. Strangelove or: How I L... | 1964 | 95 | An insane general starts a ... | http://ia.media-imdb.com/im... | 28 |
40 | Alien | 1979 | 117 | After investigating an S.O.... | http://ia.media-imdb.com/im... | 29 |
id | name | dob | bio | image |
---|---|---|---|---|
33 | Roman Polanski | 1933-08-18 | Roman Polanski is a Polish ... | http://ia.media-imdb.com/im... |
34 | Fritz Lang | 1890-12-05 | Fritz Lang was born in Vien... | http://ia.media-imdb.com/im... |
id | name | dob | bio | image |
---|---|---|---|---|
33 | Michael V. Gazzo | 1923-04-05 | Michael Vincente Gazzo was ... | http://ia.media-imdb.com/im... |
34 | G.D. Spradlin | 1920-08-31 | G.D. Spradlin started his c... | http://ia.media-imdb.com/im... |
35 | Richard Bright | 1937-06-28 | Fair complexioned, cold-eye... | |
36 | Gastone Moschin | 1929-06-08 | ||
37 | Tom Rosqui | 1928-06-12 | American character actor wi... | |
38 | Bruno Kirby | 1949-04-28 | Native New Yorker and Itali... | http://ia.media-imdb.com/im... |
39 | Frank Sivero | 1952-01-06 | http://ia.media-imdb.com/im... | |
40 | Francesca De Sapio | Born in Rome, Italy. After ... |
id | actor_id | movie_id | name |
---|---|---|---|
33 | 25 | 3 | Kay |
34 | 31 | 3 | Vito Corleone (as Robert De... |
35 | 29 | 3 | Fredo Corleone |
36 | 27 | 3 | Connie Corleone |
37 | 32 | 3 | Hyman Roth |
38 | 33 | 3 | Frankie Pentangeli |
39 | 34 | 3 | Senator Pat Geary |
40 | 35 | 3 | Al Neri |
Find the customer with the primary key 10.
customer = Customer.find(10)
=> #<Customer id: 10, first_name: "Ryan"
Find the store with the primary key 56.
store = Store.find(56)
=> #<Store id: 56, name: "JC Penny's"