graphql-activerecord 0.4.2 → 0.4.3

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: 7e2f2a7cac343945f2da7a5332b51ccea8b2f7ef
4
- data.tar.gz: 2eba4c36689d9ec94cbf0891565e173f98b1f9db
3
+ metadata.gz: eb0a5e6a7aede364e37bcc2998d14080ae9f4eb4
4
+ data.tar.gz: a6d3c703939a2dab438abde64510c176d41504ce
5
5
  SHA512:
6
- metadata.gz: fa0e5adf22cdcad41f2b0a1c1f501f4260b06e57cf8f366b6be6ede7cf9dbff8b633e95a69256ddd41e722a5c0c5de927e2c1c9a90f309b332df0ddf65b34717
7
- data.tar.gz: 6a1440577e0fb66a76e1d19906ef90185371bec0b607cf72b0177168c6d5c5307f4c86036cc23e1853c0bd7cfa297da47e36cdb81fc8fb167af3ab43fa7f2a9b
6
+ metadata.gz: 1b29432db0e4a92b1c286e59f8e447d6b01e20ac2969b1bbd117307cbe07dd2d7561ca99f4f7c076204c97d2b59dea3d0f7339f0fb71e34a4d30253442acfd47
7
+ data.tar.gz: 4eb8896e974750dcd1522b259e0ae885a67aece1a6aa3e17d2e4ae52457009d8d19276a2dbda0dee38acc0878e3c0dcc3d7206624f61816d009e0c1af5676b41
@@ -129,8 +129,9 @@ module GraphQL::Models
129
129
  grouped_models.each do |key_attrs, vals|
130
130
  child_model = vals[0]
131
131
 
132
- inputs = grouped_inputs[key_attrs][0]
133
-
132
+ inputs = grouped_inputs[key_attrs]
133
+ inputs = inputs[0] if inputs
134
+
134
135
  if inputs.nil?
135
136
  child_model.mark_for_destruction
136
137
  changes.push({ model_instance: child_model, action: :destroy })
@@ -32,7 +32,17 @@ module GraphQL::Models
32
32
 
33
33
  def save!
34
34
  fail StandardError.new("Need to call apply_changes before #{__method__}") unless @all_changes
35
- changed_models.each(&:save!).each(&:reload)
35
+ changed_models.each do |model|
36
+ next if model.destroyed?
37
+
38
+ if model.marked_for_destruction?
39
+ model.destroy
40
+ else
41
+ model.save!
42
+ end
43
+ end
44
+
45
+ changed_models.reject(&:destroyed?).each(&:reload)
36
46
  end
37
47
  end
38
48
 
@@ -1,5 +1,5 @@
1
1
  module GraphQL
2
2
  module Models
3
- VERSION = "0.4.2"
3
+ VERSION = "0.4.3"
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.4.2
4
+ version: 0.4.3
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-05-11 00:00:00.000000000 Z
11
+ date: 2016-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphql