graphql-activerecord 0.12.5 → 0.12.6

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: 6a429d53c05c94f11679d315d0981fd3eda6728c
4
- data.tar.gz: bf4daa359284e37cb5d3414a6c1df179e38e22a0
3
+ metadata.gz: 1fb8887cc7d5b635ae865e1cc117d1ec12783daa
4
+ data.tar.gz: d9be88c8349bb35660d6f1ca89ac6fabd371d2c9
5
5
  SHA512:
6
- metadata.gz: ea57e54b128dc1adbd0c30bf40d0134899f94b58e8007dfd150797dd921a1760bd9976f020999e5ec54e82e6e257c365878e525bfe91a950940897b17126a364
7
- data.tar.gz: cb04572e742543b5a0d920e8284adc8bd7b1118490418b97a7df835b3f629475fb922bf879c624f8cdf7625093da231f30ec0607c5bbdc9502c4509f1fb8c6bc
6
+ metadata.gz: 84663736f3d286de79670253345064bd31213b58c5f3d752026986199b5b9d3597b5430039a9b784fa565d8a85f7c4a4307c9ce550f440f031a809e373d1ae96
7
+ data.tar.gz: 98624d0e67daa0e3c9d1d633874c8c4b2d44591eb5fd1aa2daa4130d444e53951dc99d177454b3695645c60d8f4de96dc872f7075da39ab73e981a5208d1c036
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ # 0.12.6
4
+ - Fixed a bug when you used a `nested` mutator, and provided a symbol for the `:name` kwarg
5
+ - Fixed a bug where the `context` parameter was not being passed to `MutationHelpers::match_inputs_to_models`
6
+
3
7
  # 0.12.5
4
8
  Fixed a bug where `titleize` is sometimes called on symbols.
5
9
 
@@ -14,8 +14,8 @@ module GraphQL::Models
14
14
  end
15
15
 
16
16
  if field_map.leave_null_unchanged?
17
- field_names = field_map.fields.select { |f| !f[:required] }.map { |f| f[:name] }
18
- field_names += field_map.nested_maps.reject(&:required).map(&:name)
17
+ field_names = field_map.fields.select { |f| !f[:required] }.map { |f| f[:name].to_s }
18
+ field_names += field_map.nested_maps.reject(&:required).map { |fld| fld.name.to_s }
19
19
  field_names = field_names.sort
20
20
 
21
21
  unless field_names.empty?
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  module GraphQL::Models
3
3
  module MutationHelpers
4
- def self.validate_changes(inputs, field_map, root_model, _context, all_changes)
4
+ def self.validate_changes(inputs, field_map, root_model, context, all_changes)
5
5
  invalid_fields = {}
6
6
  unknown_errors = []
7
7
 
@@ -21,7 +21,7 @@ module GraphQL::Models
21
21
  add_error(attribute, message, attrs_to_field[attribute], invalid_fields)
22
22
  else
23
23
  # Didn't provide a value, expensive check... trace down the input field
24
- path = detect_input_path_for_attribute(model, attribute, inputs, field_map, root_model)
24
+ path = detect_input_path_for_attribute(model, attribute, inputs, field_map, root_model, context)
25
25
 
26
26
  if path
27
27
  add_error(attribute, message, path, invalid_fields)
@@ -54,7 +54,7 @@ module GraphQL::Models
54
54
  end
55
55
 
56
56
  # Given a model and an attribute, returns the path of the input field that would modify that attribute
57
- def self.detect_input_path_for_attribute(target_model, attribute, inputs, field_map, starting_model)
57
+ def self.detect_input_path_for_attribute(target_model, attribute, inputs, field_map, starting_model, context)
58
58
  # Case 1: The input field is inside of this field map.
59
59
  candidate_fields = field_map.fields.select { |f| f[:attribute] == attribute }
60
60
 
@@ -85,10 +85,10 @@ module GraphQL::Models
85
85
  next if candidate_model.nil?
86
86
 
87
87
  # Match up the inputs with the models, and then check each of them.
88
- candidate_matches = match_inputs_to_models(candidate_model, child_map, inputs[child_map.name], [])
88
+ candidate_matches = match_inputs_to_models(candidate_model, child_map, inputs[child_map.name], [], context)
89
89
 
90
90
  candidate_matches.each do |m|
91
- result = detect_input_path_for_attribute(target_model, attribute, m[:child_inputs], child_map, m[:child_model])
91
+ result = detect_input_path_for_attribute(target_model, attribute, m[:child_inputs], child_map, m[:child_model], context)
92
92
  next if result.nil?
93
93
 
94
94
  path = Array.wrap(result)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module GraphQL
3
3
  module Models
4
- VERSION = "0.12.5"
4
+ VERSION = "0.12.6"
5
5
  end
6
6
  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.12.5
4
+ version: 0.12.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Foster
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-09-21 00:00:00.000000000 Z
11
+ date: 2017-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport