Right now, if a validation fails the developer needs to write a block similar to this one in order to return a response:
unless params.valid?
response.puts {errors: params.errors}.to_json
response.status_code 400
end
A 400 response with the appropriate body should be the default procedure should a call to validate! fail. This simplifies error handling especially in situations where the response is json because in that scenario, you rarely want to return custom output in situations where the client created an invalid request.
In situations where the user has a page then we can easily return a default error page. We should have default error pages anyway so we may as well add them while we add this enhancement to controller error handling.