Skip to content

Instantly share code, notes, and snippets.

@longlostnick
Created August 4, 2011 20:46
Show Gist options
  • Save longlostnick/1126226 to your computer and use it in GitHub Desktop.
Save longlostnick/1126226 to your computer and use it in GitHub Desktop.
See if each object in an array is in another array of objects
my_objects.each do |my_object|
if my_other_objects.any?{|my_other_object| my_other_object.Name == my_object.name}
# do something if we found one
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment