graphql-sugar 0.1.2 → 0.1.3

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: f562a7bc8a52945758affa95258afcf30cf1ccc9
4
- data.tar.gz: 2de8c9edece7f4d8d1290cc4f81bfe1a35c4aa09
3
+ metadata.gz: 4fb063cadbfd8e490a701b23d0a6fe7efbce9712
4
+ data.tar.gz: e2eb380c40825945afb4a889433eab7bcea5fa8e
5
5
  SHA512:
6
- metadata.gz: e5719b575b8dc6da9b12c9c91ce0d353dc6e1289f3d5e10ba67a93e00508dd0fdd9c6cddb2b540e73be330211c2b54f97cd23b588dce10d8ba602d506b866b7f
7
- data.tar.gz: 5b53bee24e49699dd5de555cbea641997e23ff3c4dbce0e39b65dda1c7f7071381200f01aebaa606d1594ef2ad7884fff2e5365cd5cbcc0d83f550210bf0b4f6
6
+ metadata.gz: ed5fc3820e397f25bda5a5687e82633e9c4f62bf9b23180628fd36db0794f777b37fd8b803b2ed8c5d1b9d0efbeed075eaf36c76e1e204c6a7e7b122881ec12a
7
+ data.tar.gz: 69e3fc34c0ce52277808a513085d97ab25a4a08239a9c304eec7832e2a91c8dde2aa6d6ee3d6c753593bd68985297012317ac9a3c48297f271b4e9f2bf165b95
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.1.3] - 2017-12-12
10
+ ### Fixed
11
+ - Fix has_one relationship (#1)
12
+
9
13
  ## [0.1.2] - 2017-11-07
10
14
  ### Added
11
15
  - This CHANGELOG file
@@ -21,6 +25,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
21
25
  ### Added
22
26
  - First release of this gem
23
27
 
24
- [Unreleased]: https://github.com/keepworks/graphql-sugar/compare/v0.1.2...HEAD
28
+ [Unreleased]: https://github.com/keepworks/graphql-sugar/compare/v0.1.3...HEAD
29
+ [0.1.3]: https://github.com/keepworks/graphql-sugar/compare/v0.1.2...v0.1.3
25
30
  [0.1.2]: https://github.com/keepworks/graphql-sugar/compare/v0.1.1...v0.1.2
26
31
  [0.1.1]: https://github.com/keepworks/graphql-sugar/compare/v0.1.0...v0.1.1
@@ -11,7 +11,7 @@ module GraphQL
11
11
  define_belongs_to(type_defn, field_name, model_class, association_name, association)
12
12
  elsif association.association_class == ActiveRecord::Associations::HasOneAssociation ||
13
13
  association.association_class == ActiveRecord::Associations::HasManyAssociation
14
- define_has_many(type_defn, field_name, model_class, association_name, association)
14
+ define_has_one_or_many(type_defn, field_name, model_class, association_name, association)
15
15
  end
16
16
  end
17
17
 
@@ -35,11 +35,14 @@ module GraphQL
35
35
  GraphQL::Define::AssignObjectField.call(type_defn, field_name, type: type, property: property)
36
36
  end
37
37
 
38
- def self.define_has_many(type_defn, field_name, _model_class, association_name, association)
38
+ def self.define_has_one_or_many(type_defn, field_name, _model_class, association_name, association)
39
39
  kwargs = {}
40
40
 
41
41
  kwargs[:type] = "Types::#{association.klass}Type".constantize
42
- kwargs[:type] = kwargs[:type].to_non_null_type.to_list_type
42
+
43
+ if association.association_class == ActiveRecord::Associations::HasManyAssociation
44
+ kwargs[:type] = kwargs[:type].to_non_null_type.to_list_type
45
+ end
43
46
 
44
47
  begin
45
48
  function_class = Sugar.get_resolver_function(field_name)
@@ -1,5 +1,5 @@
1
1
  module GraphQL
2
2
  module Sugar
3
- VERSION = '0.1.2'
3
+ VERSION = '0.1.3'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql-sugar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pradeep Kumar
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-11-07 00:00:00.000000000 Z
11
+ date: 2017-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler