I have two arrays. One Mapper and one with my ID's.
My Array with the external ID's:
genres_array = [12,28,16]
The Mapper Array (Internal-ID, External-ID)
mapper = [
[1,12],
[2,18],
[3,19],
[4,28],
[5,16],
[6,90],
]
As Result i would like to have now a new array, with only the internal values of the genres_array (the genres_array had the external values first). In this case the result would be [1,4,5]
I tried a lot of ways but i really have no idea how to solve this simple problem in a clean way. Im pretty sure it will be something like
genres_array.map { |genre_id| get_internal_id_from_mapper }
PS: It could also happen that a ID won't be found in the mapper. In that i case i just want to remove it from the array. Any idea?