Created
August 13, 2015 17:07
-
-
Save Sillson/1660df5945d87117e2ed to your computer and use it in GitHub Desktop.
Find dupes
This file contains hidden or 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
# How to find duplicate website objects in a CMS! | |
#map an array of all websites 'owner_id' | |
loc_ids = Website.all.map {|web| web.owner_id} | |
#returns the duplicates | |
loc_ids.select{ |id| loc_ids.count(id) > 1}.uniq |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment