X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/2e1892bbd21d7ac8432c923fa84eb8526cfae558..d6c7e2952413c33a4af9b1599e4000b9df622661:/services/api/lib/sweep_trashed_objects.rb?ds=sidebyside diff --git a/services/api/lib/sweep_trashed_objects.rb b/services/api/lib/sweep_trashed_objects.rb index 1dc45a0ca1..59008c0fc3 100644 --- a/services/api/lib/sweep_trashed_objects.rb +++ b/services/api/lib/sweep_trashed_objects.rb @@ -7,7 +7,7 @@ require 'current_api_client' module SweepTrashedObjects extend CurrentApiClient - def delete_project_and_contents(p_uuid) + def self.delete_project_and_contents(p_uuid) p = Group.find_by_uuid(p_uuid) if !p || p.group_class != 'project' raise "can't sweep group '#{p_uuid}', it may not exist or not be a project" @@ -20,7 +20,7 @@ module SweepTrashedObjects # exceptions, and delete records owned by this project skipped_classes = ['Group', 'User'] ActiveRecord::Base.descendants.reject(&:abstract_class?).each do |klass| - if !skipped_classes.include?(klass.name) && klass.columns.collect{|c| c.name}.include?('owner_uuid') + if !skipped_classes.include?(klass.name) && klass.columns.collect(&:name).include?('owner_uuid') klass.where({owner_uuid: p_uuid}).destroy_all end end