Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save saroar/232c323a6ea4d563b8dbf96d31bcae41 to your computer and use it in GitHub Desktop.

Select an option

Save saroar/232c323a6ea4d563b8dbf96d31bcae41 to your computer and use it in GitHub Desktop.
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