graphql-searchkick 0.2.0 → 0.3.0

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
  SHA256:
3
- metadata.gz: 4fee00e8a9d4edbe1018df1d8982027893e187fb27badc7e09e7f73e47d132db
4
- data.tar.gz: 901185c3a8834928539f8f2fcb310e9b5653b3e8cc896115dab20bad88f04784
3
+ metadata.gz: e7cd3f32d5911c582242dd3eada324780dcc7bdbb71d36ea02ef381056cbd746
4
+ data.tar.gz: 95cd5dcbcacb622785bcbc5fc03ca7de14a237f49b6065ec7d3a39d971bdfc9a
5
5
  SHA512:
6
- metadata.gz: dd780c7d95f84876a8d4d50b6852e34f14d947ce305895fbbd6c953861ec931abbe29d4da721b2760a571d7f4ee4606c7fd5c217fa7f36ad55c49fd940b7e564
7
- data.tar.gz: a03fa9e8472e1da6e89af95a12d95d7e3d901d7438cc5cf0fb8f17270216154f582dbc14380acad0023ebff0e9892627a824a5f5c5641d13654bc26d1d79a380
6
+ metadata.gz: b652f084bf034cdd176c137ee5b65de299c37bb85a333471b6ebc1502d7b016c42a8fa8a8eec8a59d09c22e1d813af8e11a481b15f3a2902971bbdeb5fd45854
7
+ data.tar.gz: 86d12ca1727e042b42ea211607a88367cf2d70c726b9195095d76a062d0cea3b9f0921e2fc98fa791c740b594dea801ca196324bc3d75b29521714e2d9f990c7
data/README.md CHANGED
@@ -8,7 +8,7 @@ Integrate Searchkick with GraphQL Connections easily.
8
8
 
9
9
  ## Note
10
10
 
11
- The current version of the gem only works with `GraphQL::Relay::BaseConnection` and descendants. If you need support for `GraphQL::Pagination::Connection` feel free to open an issue or create a PR.
11
+ The current version of the gem only works with `GraphQL::Pagination::Connection` . If you need support for the older `GraphQL::Relay::BaseConnection` version use v0.1.0.
12
12
 
13
13
  ## Considerations & Limits
14
14
 
@@ -43,6 +43,15 @@ class BaseField < GraphQL::Schema::Field
43
43
  end
44
44
  ```
45
45
 
46
+ Add the connection to your schema.
47
+
48
+ ```ruby
49
+ class Schema < GraphQL::Schema
50
+ use GraphQL::Pagination::Connections
51
+ connections.add(GraphQL::Searchkick::LazySearch, GraphQL::Searchkick::ResultConnection)
52
+ end
53
+ ```
54
+
46
55
  ## Usage
47
56
 
48
57
  Add `search: ModelClass` to any connection field that you want to allow querying.
@@ -14,8 +14,12 @@ module GraphQL
14
14
  query = next_args.delete(:query)
15
15
  result = yield(object, next_args)
16
16
 
17
- model = options[:model_class]
18
- LazySearch.new(result, query: query, model_class: model)
17
+ if defined?(ActiveRecord::Relation) && result.is_a?(ActiveRecord::Relation)
18
+ result
19
+ else
20
+ model = options[:model_class]
21
+ LazySearch.new(result, query: query, model_class: model)
22
+ end
19
23
  end
20
24
  end
21
25
  end
@@ -1,5 +1,5 @@
1
1
  module Graphql
2
2
  module Searchkick
3
- VERSION = "0.2.0"
3
+ VERSION = '0.3.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql-searchkick
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chad Wilken
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-14 00:00:00.000000000 Z
11
+ date: 2020-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appraisal