graphql-active_record 2.2.1 → 2.2.2
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: 9bdc7ab9b28d7a7bad0891c742b5b0fb72e7a1bc
|
4
|
+
data.tar.gz: ce12f8396bf35abc87c1b963634f8b935e8a911c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1e7977bd16d41d5b0cd0cfd820483221d7de8410a82091015903cac9e1765b58837c1b6eb2b592cd5c4d7b002ac523e4c10f36f3562a787ae85e5a949dfe792
|
7
|
+
data.tar.gz: 51f41cc5ab110eb15d3667fb776e4378c531472679d1c1451ef71ea6b8c3f775090b4a554ba9947104f6553781851a24d90feea2fd98e868238e722d787920a7
|
data/CHANGELOG.md
CHANGED
@@ -80,11 +80,14 @@ module GraphQL
|
|
80
80
|
|
81
81
|
nested = map_includes(next_model, node.selections, ctx)
|
82
82
|
|
83
|
-
|
83
|
+
singular_reflection = model.reflections[singular] || model.reflections[singular.to_sym]
|
84
|
+
plural_reflection = model.reflections[plural] || model.reflections[plural.to_sym]
|
85
|
+
|
86
|
+
final_type = if valid_association(singular_reflection)
|
84
87
|
# this is for has_one relationships
|
85
88
|
singular
|
86
89
|
|
87
|
-
elsif (
|
90
|
+
elsif valid_association(plural_reflection)
|
88
91
|
# this is for has_many relationships
|
89
92
|
plural
|
90
93
|
|
@@ -142,6 +145,19 @@ module GraphQL
|
|
142
145
|
[node.name, node]
|
143
146
|
end
|
144
147
|
end
|
148
|
+
|
149
|
+
##
|
150
|
+
# Method to check whether a reflection is valid.
|
151
|
+
# Some things, like PowerEnum, have reflections but do not work properly
|
152
|
+
# because they do not have an association_class. So ignore them.
|
153
|
+
#
|
154
|
+
# @param reflection [ActiveRecord::Associations::* | any | nil] Inputted Association
|
155
|
+
# @return [boolean] Whether or not the association is valid
|
156
|
+
def self.valid_association(reflection)
|
157
|
+
return false if reflection.blank?
|
158
|
+
return false unless reflection.respond_to?(:association_class)
|
159
|
+
return (reflection.association_class < ActiveRecord::Associations::Association)
|
160
|
+
end
|
145
161
|
end
|
146
162
|
end
|
147
163
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql-active_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Jurgens
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: graphql
|
@@ -232,9 +232,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
232
232
|
version: '0'
|
233
233
|
requirements: []
|
234
234
|
rubyforge_project:
|
235
|
-
rubygems_version: 2.
|
235
|
+
rubygems_version: 2.5.2
|
236
236
|
signing_key:
|
237
237
|
specification_version: 4
|
238
238
|
summary: Active Record Helpers for graphql-ruby
|
239
239
|
test_files: []
|
240
|
-
has_rdoc:
|