I'm having troubles with 2D arrays to get the values that exist in one array and don't exist in another one.
We have 2 arrays
[["001", 1, 3333, "maja", "eka", 17, "110B"], ["005", 1, 1434, "buve", "eka", 27, "110A"], ["008", 1, 1111, "maja", "", 31, "110"]]
And the second one
[["001", 1, 3333, "maja", "eka", 17, "110B"], ["007", 1, 3381, "buve", "eka", 31, "110"], ["009", 1, 2824, "maja", "", 28, "110C"]]
So the output should be the
[["007", 1, 3381, "buve", "eka", 31, "110"], ["009", 1, 2824, "maja", "", 28, "110C"]]
Atm I'm doing it in this way, but I struggle because it returns only 1 record
detect = []
records = first_array.collect {|a| a[0]} - second_array.collect {|a| a[0]}
records.each do |r|
detect = first_array.detect { |k, v| k == r }
end
return detect