Below are two tables with some sample data :-
Uploads:
id: 1 , file_ref:abc
id: 2, file_ref: abc1
id: 4, file_ref: abc3
id: 5, file_ref: abc4
id: 6, file_ref: abc5
id: 7, file_ref: abc6
media:
id: 3, name: 'My Doc' , type: doc
id: 6, name: 'My Img' , type: img
I have these 2 models in rails. Now in my controller I want to get all records in uploads if their id exists in the media table i.e. records from upload table with ids 3 and 6.