If a DELETE
request fails, because the resource to be deleted still has child records associated to it and an ActiveRecord::DeleteRestrictionError
exception is raised, what is the proper HTTP response code to be returned? 422?
What is the proper HTTP response code for ActiveRecord::DeleteRestrictionError
123 views Asked by Alexander Popov At
1
I'd say you could use either 422 or the more vague 500.
422 is plausible since the server understands the content type of the request entity and the syntax of the request entity is correct but was unable to process the contained instructions.
500 is plausible since the server did encounter an unexpected condition which prevented it from fulfilling the request (and associated child records are a server side issue).
Source