diff --git a/app/services/safe_object_type_destroy_service.rb b/app/services/safe_object_type_destroy_service.rb index d25ae86beac1e3e739013881ea3dd19bcbbf2db4..ab0bb89a4287e84c0b185d79eb001629b2158d42 100644 --- a/app/services/safe_object_type_destroy_service.rb +++ b/app/services/safe_object_type_destroy_service.rb @@ -2,7 +2,7 @@ class SafeObjectTypeDestroyService def self.execute(object_type) default_type = ObjectType.find_or_create_by(name: 'Outros') - object_type.learning_objects.each{|lo| lo.update_attribute(:object_type, default_type)} + LearningObject.where(object_type: object_type).update_all(object_type_id: default_type.id) object_type.destroy end