standardapi 1.0.18 → 1.0.19
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e568bcafb624da9ac84b8f85b975bba6ac051e7
|
4
|
+
data.tar.gz: 33d3ba09653ace45e6cc31f5551d330517e85ba8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 589496fddcc6ffe77ab69c8104f6c8a73a472ceceb283767a70a6d07d1eab9aadef191f5a1e6f087360f9bf9b1adbdd8e8e99d904ccd2ff04c6b19aeeaad2d95
|
7
|
+
data.tar.gz: 77d5e322883ed99681ddc466f898ed67f71254f888ce81357a96d1540d61aa4f7ad4418965dc8db63ed82dc26183a154f3dd92d9491e18f213cf5faeffbc5fba
|
data/lib/standard_api/helpers.rb
CHANGED
@@ -2,7 +2,7 @@ module StandardAPI
|
|
2
2
|
module Helpers
|
3
3
|
|
4
4
|
def model_partial(record)
|
5
|
-
if lookup_context.exists?(record.model_name.element,
|
5
|
+
if lookup_context.exists?(record.model_name.element, record.model_name.plural, true)
|
6
6
|
[record.model_name.plural, record.model_name.element].join('/')
|
7
7
|
else
|
8
8
|
'application/record'
|
@@ -15,15 +15,21 @@ includes.each do |inc, subinc|
|
|
15
15
|
json.array! record.send(inc), partial: partial, as: partial.split('/').last, locals: { includes: subinc }
|
16
16
|
else
|
17
17
|
if record.send(inc).nil?
|
18
|
-
json.
|
18
|
+
json.null!
|
19
19
|
else
|
20
20
|
partial = model_partial(record.send(inc))
|
21
|
-
json.partial! partial, partial.split('/').last => record.send(inc), includes: subinc
|
21
|
+
json.partial! partial, partial.split('/').last.to_sym => record.send(inc), includes: subinc
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
25
25
|
else
|
26
|
-
json.set! inc
|
26
|
+
json.set! inc do
|
27
|
+
if record.send(inc).nil?
|
28
|
+
json.null!
|
29
|
+
else
|
30
|
+
record.send(inc).as_json
|
31
|
+
end
|
32
|
+
end
|
27
33
|
end
|
28
34
|
end
|
29
35
|
|