model_driven_api 3.9.1 → 3.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2814cf6ff3fc8c2b60cb3b663aa0860d25161c8cd0971a6b76f3efd0b29df966
|
|
4
|
+
data.tar.gz: 519245af607dff7b04652b65efb88584dc6559f6cc21a60a5591e7c081a9a00d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d15e193b9f21739e577dbc8243e4bb44ff127fa048d4cef33551b58ee55349f27ccd1ca99ac16044c2eed5f844924389542df276f1d7ba06e89d294af5deb164
|
|
7
|
+
data.tar.gz: 889853a5ce035794316072a74515842f4a43d41a056523de35993bccf270b51475ac195d5b2b96f08db5b1f6829ab47936616a9e162c7bac682b988ee641a6a5
|
|
@@ -112,7 +112,9 @@ class Api::V2::ApplicationController < ActionController::API
|
|
|
112
112
|
return render json: result, status: (status_number.presence || 200) if status == true
|
|
113
113
|
|
|
114
114
|
# Normal Destroy Action
|
|
115
|
-
|
|
115
|
+
# A validation/before_destroy guard (e.g. dependent: :restrict_with_error) blocking this
|
|
116
|
+
# destroy populates @record.errors — surface it as a 422, not a bodyless 500.
|
|
117
|
+
return api_error(status: 422, errors: @record.errors) unless @record.destroy
|
|
116
118
|
head :ok
|
|
117
119
|
end
|
|
118
120
|
|
|
@@ -9,6 +9,10 @@ module ApiExceptionManagement
|
|
|
9
9
|
rescue_from ActionController::RoutingError, with: :not_found!
|
|
10
10
|
rescue_from ActiveModel::ForbiddenAttributesError, with: :fivehundred!
|
|
11
11
|
rescue_from ActiveRecord::RecordInvalid, with: :invalid!
|
|
12
|
+
# A destroy blocked by dependent: :restrict_with_error or a before_destroy guard
|
|
13
|
+
# (e.g. Task's time_tables-present guard, docs/adr/0010, host repo) raises this via
|
|
14
|
+
# #destroy! — reuse invalid! since both exceptions expose the same .record interface.
|
|
15
|
+
rescue_from ActiveRecord::RecordNotDestroyed, with: :invalid!
|
|
12
16
|
rescue_from ActiveRecord::RecordNotFound, with: :not_found!
|
|
13
17
|
rescue_from ActiveRecord::RecordNotUnique, with: :invalid!
|
|
14
18
|
# Rescue Stale Object in Optimistick locking with stale!
|