graphql_activerecord_autoselect 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +12 -12
- data/lib/graphql_activerecord_autoselect/version.rb +1 -1
- metadata +5 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: caecb8f7b7d48b1b7c9142fe3da73950aa80318d1479e38a54359c6d3ff5ca36
|
4
|
+
data.tar.gz: 52498c2f7bef76df343f6b5d4b3d1e8f3dc79436840730048eea1b44ae5f4841
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e796c6d19a6c2965d6b34dcb0dfafad3d01633da4f2c8828829743c8d574cf260d249483e8b1575cc98df1d5840fe61bf2a519e147c963b7a35d9f41453a4f9
|
7
|
+
data.tar.gz: c418278df367e06b6beb79dadce9929e6d3fe1e4ef20d55dbfbbfd29897661f8e3f8f285289a11201bacd823200ce412e9dd2007921e6097c97de63427357c91
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -13,7 +13,7 @@ The documentation can be found on [RubyDoc].
|
|
13
13
|
### Compatibility
|
14
14
|
|
15
15
|
- Ruby 2.5+
|
16
|
-
- ActiveRecord
|
16
|
+
- ActiveRecord 5.0+
|
17
17
|
- GraphQL (Ruby) 1.9+
|
18
18
|
|
19
19
|
|
@@ -28,7 +28,7 @@ gem "graphql_activerecord_autoselect", "~> 1"
|
|
28
28
|
|
29
29
|
### Example
|
30
30
|
|
31
|
-
```
|
31
|
+
```ruby
|
32
32
|
class Types::Actor < Types::Base::Object
|
33
33
|
using GraphQLActiveRecordAutoSelect
|
34
34
|
|
@@ -50,7 +50,7 @@ end
|
|
50
50
|
|
51
51
|
In this example an actor has many organizations. We allow the client to query all of the actor's organizations, or a specific one by id. We acquire the lookahead functionality provided by GraphQL Ruby and pass it to `autoselect`.
|
52
52
|
|
53
|
-
The `autoselect` method is made available to all instances of ActiveRecord::
|
53
|
+
The `autoselect` method is made available to ActiveRecord::Base at the class level, as well as to all instances of ActiveRecord::Relations, in classes where the GraphQLActiveRecordAutoSelect refinement is used (`using GraphQLActiveRecordAutoSelect`).
|
54
54
|
|
55
55
|
If you submit the following query to the server:
|
56
56
|
|
@@ -67,13 +67,13 @@ query {
|
|
67
67
|
|
68
68
|
It'll translate this:
|
69
69
|
|
70
|
-
```
|
70
|
+
```ruby
|
71
71
|
object.organizations.autoselect(lookahead)
|
72
72
|
```
|
73
73
|
|
74
74
|
Into this:
|
75
75
|
|
76
|
-
```
|
76
|
+
```ruby
|
77
77
|
object.organizations.select(:id, :actor_id, :name, :time_zone)
|
78
78
|
```
|
79
79
|
|
@@ -88,7 +88,7 @@ The following fields are always selected:
|
|
88
88
|
|
89
89
|
The example above builds a select on a has many relation, but the same works for belongs to.
|
90
90
|
|
91
|
-
```
|
91
|
+
```ruby
|
92
92
|
class Types::Organization < Types::Base::Object
|
93
93
|
using GraphQLActiveRecordAutoSelect
|
94
94
|
|
@@ -114,13 +114,13 @@ query {
|
|
114
114
|
|
115
115
|
It'll translate this:
|
116
116
|
|
117
|
-
```
|
117
|
+
```ruby
|
118
118
|
Actor.autoselect(lookahead).find(object.actor_id)
|
119
119
|
```
|
120
120
|
|
121
121
|
Into this:
|
122
122
|
|
123
|
-
```
|
123
|
+
```ruby
|
124
124
|
Actor.select(:id, :email).find(object.actor_id)
|
125
125
|
```
|
126
126
|
|
@@ -129,7 +129,7 @@ Actor.select(:id, :email).find(object.actor_id)
|
|
129
129
|
|
130
130
|
You might have fields or methods that depend on the presence of one or more fields. You can specify dependents to ensure that the requested field or method will be able to successfully compute:
|
131
131
|
|
132
|
-
```
|
132
|
+
```ruby
|
133
133
|
class Actor < ActiveRecord::Base
|
134
134
|
def secret
|
135
135
|
decrypt(secret_digest)
|
@@ -196,13 +196,13 @@ query {
|
|
196
196
|
|
197
197
|
It'll translates this:
|
198
198
|
|
199
|
-
```
|
199
|
+
```ruby
|
200
200
|
Actor.autoselect(lookahead, Actor.dependents).find(object.actor_id)
|
201
201
|
```
|
202
202
|
|
203
203
|
Into this:
|
204
204
|
|
205
|
-
```
|
205
|
+
```ruby
|
206
206
|
Actor.select(:id, :email, :first_name, :last_name, :secret_digest).find(object.actor_id)
|
207
207
|
```
|
208
208
|
|
@@ -270,7 +270,7 @@ Released under the [MIT License] by [Michael van Rooijen].
|
|
270
270
|
|
271
271
|
[Michael van Rooijen]: https://michael.vanrooijen.io
|
272
272
|
[HireFire]: https://www.hirefire.io
|
273
|
-
[RubyDoc]: https://rubydoc.info/
|
273
|
+
[RubyDoc]: https://rubydoc.info/github/mrrooijen/graphql_activerecord_autoselect/master
|
274
274
|
[MIT License]: https://github.com/mrrooijen/graphql_activerecord_autoselect/blob/master/LICENSE.txt
|
275
275
|
[GraphQL (Ruby)]: https://github.com/rmosolgo/graphql-ruby
|
276
276
|
[ActiveRecord]: https://github.com/rails/rails/tree/master/activerecord
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql_activerecord_autoselect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael van Rooijen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 5.0.0
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: 7.0.0
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: 5.0.0
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 7.0.0
|
@@ -106,20 +106,6 @@ dependencies:
|
|
106
106
|
- - '='
|
107
107
|
- !ruby/object:Gem::Version
|
108
108
|
version: 0.18.5
|
109
|
-
- !ruby/object:Gem::Dependency
|
110
|
-
name: sqlite3
|
111
|
-
requirement: !ruby/object:Gem::Requirement
|
112
|
-
requirements:
|
113
|
-
- - '='
|
114
|
-
- !ruby/object:Gem::Version
|
115
|
-
version: 1.4.2
|
116
|
-
type: :development
|
117
|
-
prerelease: false
|
118
|
-
version_requirements: !ruby/object:Gem::Requirement
|
119
|
-
requirements:
|
120
|
-
- - '='
|
121
|
-
- !ruby/object:Gem::Version
|
122
|
-
version: 1.4.2
|
123
109
|
description:
|
124
110
|
email:
|
125
111
|
- michael@vanrooijen.io
|
@@ -140,7 +126,7 @@ metadata:
|
|
140
126
|
source_code_uri: https://github.com/mrrooijen/graphql_activerecord_autoselect
|
141
127
|
changelog_uri: https://github.com/mrrooijen/graphql_activerecord_autoselect/blob/master/CHANGELOG.md
|
142
128
|
bug_tracker_uri: https://github.com/mrrooijen/graphql_activerecord_autoselect/issues
|
143
|
-
documentation_uri: https://rubydoc.info/gems/graphql_activerecord_autoselect
|
129
|
+
documentation_uri: https://rubydoc.info/gems/graphql_activerecord_autoselect/1.0.1
|
144
130
|
post_install_message:
|
145
131
|
rdoc_options: []
|
146
132
|
require_paths:
|