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: a335bf3f3a1df576a464d696cfb2c4e08db85ebd
4
- data.tar.gz: b1c17381aa0c534ccaec58ffa3a9d86fe53d37f0
3
+ metadata.gz: 3e568bcafb624da9ac84b8f85b975bba6ac051e7
4
+ data.tar.gz: 33d3ba09653ace45e6cc31f5551d330517e85ba8
5
5
  SHA512:
6
- metadata.gz: 6d08cab6b53e58fff34afd58d359c51bc4ae72f7d020d5ee35f649fc0f7f7589185225771b5dabd4a0a2250c5ec1f7d630c2b116368a7c62155b00bd2e0b9a0f
7
- data.tar.gz: 5193ba62c57aa0aa3e997a73875ebf66434a06228897b5e13adb682a32cfefc802b5d562286a6815f30b190fa3c03b163ae373777df66bb54e76c9329deea489
6
+ metadata.gz: 589496fddcc6ffe77ab69c8104f6c8a73a472ceceb283767a70a6d07d1eab9aadef191f5a1e6f087360f9bf9b1adbdd8e8e99d904ccd2ff04c6b19aeeaad2d95
7
+ data.tar.gz: 77d5e322883ed99681ddc466f898ed67f71254f888ce81357a96d1540d61aa4f7ad4418965dc8db63ed82dc26183a154f3dd92d9491e18f213cf5faeffbc5fba
@@ -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, controller_name, true)
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.set! association.klass.model_name.element, nil
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, record.send(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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: standardapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.18
4
+ version: 1.0.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Bracy