Created
July 18, 2012 11:06
-
-
Save certainty/3135595 to your computer and use it in GitHub Desktop.
there you go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
your_map = @users.inject({}) do |m,u| | |
duplicates = @users.select{ |u2| u.id != u2.id && u.email == u2.email } | |
(m[u.email] ||= []).concat(duplicates) unless duplicates.empty? | |
m | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment