Skip to content

Instantly share code, notes, and snippets.

@joshmcarthur
Created March 20, 2013 22:17
Show Gist options
  • Save joshmcarthur/5209042 to your computer and use it in GitHub Desktop.
Save joshmcarthur/5209042 to your computer and use it in GitHub Desktop.
Remove all instances of duplicates from an array (this may not be the best way)
@duplicate_pharmacists = @pharmacists - @pharmacists.reject { |pharmacist| @pharmacists.select { |p| p.email == pharmacist.email }.size > 1 }
@pharmacists -= @duplicate_pharmacists
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment