I have an array of objects and I need to find the last element that matches a specific condition. I tried to do it with each_reverse, but it ended up with too much of a code:
matching_item = nil items.reverse_each do |item| if (item.type_id == 10) matching_item = item break end end Is it possible to make it shorter?