diff --git a/app/factories/bulkrax/valkyrie_object_factory.rb b/app/factories/bulkrax/valkyrie_object_factory.rb index 44183173..5fcf3b09 100644 --- a/app/factories/bulkrax/valkyrie_object_factory.rb +++ b/app/factories/bulkrax/valkyrie_object_factory.rb @@ -230,10 +230,10 @@ def new_remote_files def conditionally_destroy_existing_files return unless @replace_files - case klass - when Hyrax::PcdmCollection, Hyrax::FileSet + + if [Hyrax::PcdmCollection, Hyrax::FileSet].include?(klass) return - when Valkyrie::Resource + elsif klass.ancestors.include?(Valkyrie::Resource) destroy_existing_files else raise "Unexpected #{klass} for #{self.class}##{__method__}"