graphql-activerecord 0.6.1 → 0.6.2

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
  SHA1:
3
- metadata.gz: 14c3ac2bed55b915bbe523e23a38f3ad7458a4f4
4
- data.tar.gz: b0b306f3f85e39aaf12f5947e6bd17f63613d446
3
+ metadata.gz: dbefcc53e87e244a7244d23d78409e16fbec44e4
4
+ data.tar.gz: f566c6909cc03a8e6a7a3aa19620a35951f6eb8b
5
5
  SHA512:
6
- metadata.gz: 71d201ce0f6c49e7aa571b8f4b5d0e3a3e5ee56eb869f73eef9d5e0d8af0c65fca479ea7669c569634302c76e05f2078f95564d7f4b92cd63bbfa2d8fce3c35b
7
- data.tar.gz: 5bc5996afde1968032fa03e07f7bbe96ab5ad3b3fec3b3e7e8f16042531d40ce7ff6046e18f1b75521b20bc96113cc6958e6c9e71dee31bfaa0d22937ea03fed
6
+ metadata.gz: 9517d487ec69c2d4f505dba3dc9c686e9ee33de6e1fffa463eebd86f1aeb8d34f947603b0dacd5198925c18ed0320f35cd655d36de283dafa3f24bba53a19efc
7
+ data.tar.gz: 65ea1b55f1a0d6afa022ac9e1682254e9c9bc65a53a28879e709523af734fc1b83becf2885672b4e0f339263992e59b0be5b2593284c4c87eb0ded3bdc750d54
@@ -53,6 +53,8 @@ module GraphQL::Models
53
53
  matches = match_inputs_to_models(parent_model, child_map, next_inputs, changes)
54
54
 
55
55
  matches.each do |match|
56
+ next if match[:child_model].nil? && match[:child_inputs].nil?
57
+
56
58
  child_changes = apply_changes(child_map, match[:child_model], match[:child_inputs], context)
57
59
 
58
60
  if match[:input_path]
@@ -71,7 +73,10 @@ module GraphQL::Models
71
73
  if !child_map.has_many
72
74
  child_model = model.public_send(child_map.association)
73
75
 
74
- unless child_model
76
+ if next_inputs.nil? && !child_model.nil?
77
+ child_model.mark_for_destruction
78
+ changes.push({ model_instance: child_model, action: :destroy })
79
+ elsif child_model.nil? && !next_inputs.nil?
75
80
  child_model = model.public_send("build_#{child_map.association}")
76
81
  changes.push({ model_instance: child_model, action: :create })
77
82
  end
@@ -34,7 +34,7 @@ module GraphQL::Models
34
34
  fail StandardError.new("Need to call apply_changes before #{__method__}") unless @all_changes
35
35
  changed_models.each do |model|
36
36
  next if model.destroyed?
37
-
37
+
38
38
  if model.marked_for_destruction?
39
39
  model.destroy
40
40
  else
@@ -1,5 +1,5 @@
1
1
  module GraphQL
2
2
  module Models
3
- VERSION = "0.6.1"
3
+ VERSION = "0.6.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql-activerecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Foster
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-03 00:00:00.000000000 Z
11
+ date: 2016-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphql