Last active
July 22, 2016 09:06
-
-
Save saroar/232c323a6ea4d563b8dbf96d31bcae41 to your computer and use it in GitHub Desktop.
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
| def self.remove_dup | |
| #SubWorking.select(:sub_working_title).group(:sub_working_title).having("count(*) > 1") | |
| value = nil | |
| SubWorking.order("sub_working_title ASC").each do |record| | |
| if record.sub_working_title == value | |
| # duplicate | |
| record.destroy | |
| else | |
| # first entry | |
| value = record.sub_working_title | |
| end | |
| end | |
| end | |
| def self.remove_dup | |
| value = nil | |
| Specialist.order("name ASC").each do |record| | |
| if record.name == value | |
| # duplicate | |
| record.destroy | |
| else | |
| # first entry | |
| value = record.name | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment