tramway-api 1.8.6.5 → 1.8.6.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/serializers/tramway/api/v1/error_serializer.rb +14 -12
- data/lib/tramway/api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c073884812f246c0b76d5367b19c2f1348dbe8539286b08027487e716e2dd959
|
4
|
+
data.tar.gz: d49ede45c33a877a8deea8dcb9fb0285d1ef0d2154cd9e44109b0801e0280e4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a26de6225b11387505eac518f7d2ddec5ea0d3070007f6838e4d5192e9296793eed0f2c38af2a445286fffc0fc4f2bdb65fb449f32a6c64e4be13d2c51ce1270
|
7
|
+
data.tar.gz: 33e67a11a31f45d4413d8f24a8f7a75075a38f74f3f99cb0456be838f59ccf38acf0f3cf4649cc27c6fb054e0f4349ff0b78fbf241a66204650685ab7f95d4b7
|
@@ -22,21 +22,23 @@ class Tramway::Api::V1::ErrorSerializer < ActiveModel::Serializer
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
if object.model
|
26
|
-
object.model
|
27
|
-
|
25
|
+
if object.respond_to? :model
|
26
|
+
if object.model
|
27
|
+
object.model.errors.messages.each do |name, messages|
|
28
|
+
error_messages.merge!((path + [name]).join('/') => messages)
|
29
|
+
end
|
28
30
|
end
|
29
|
-
end
|
30
31
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
32
|
+
object.model&.attributes&.each do |attribute_key, attribute_value|
|
33
|
+
if attribute_value.is_a?(Array)
|
34
|
+
attribute_value.each_with_index do |array_attribute_value, array_attribute_key|
|
35
|
+
error_messages.merge!(
|
36
|
+
error_messages(
|
37
|
+
array_attribute_value,
|
38
|
+
path + [attribute_key] + [array_attribute_key]
|
39
|
+
)
|
38
40
|
)
|
39
|
-
|
41
|
+
end
|
40
42
|
end
|
41
43
|
end
|
42
44
|
end
|
data/lib/tramway/api/version.rb
CHANGED