graphql-activerecord 0.7.0 → 0.7.1

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: ba393c0528ebe3d08f24276c21093661c300c273
4
- data.tar.gz: 06f269998f7a64044385355e1903c35d1b47d6cf
3
+ metadata.gz: f86267939f32f4c1833c71f8002ddd96c5ce0463
4
+ data.tar.gz: d644a4fb9cc3ea8e2eb487dd889a59f1d804807d
5
5
  SHA512:
6
- metadata.gz: de38713b1668f9b52f2c6e8d4541ccb98a1b395bc15da96e2525da0c71b7d5385c0c434c6b3f2432592ebcf79410a6e758bbc246d21dcb2cdbdfe2e1e2e17b5b
7
- data.tar.gz: 5d4efe47c646569527493e8c59f39cf1e064209d321b344ed974781a030eeb6a6de4f78705eb75cc54b4efafbc9b4ddec96ef3ed71f806236390ba01e5f640ea
6
+ metadata.gz: 35aef7c3eb5ac3778258192a4fe7df1d57269d04fc4964a5d85a62d68a49c16df6f7b27ae5e0c6ed4d91caf534f84a11e9d18a69ab8f0be1cb86d8f3b74ea62a
7
+ data.tar.gz: 36c5cff269cb4a7682b2c144fc491d3c09eea733f39fdfed5a5b38ebc029901420b237b203d98aed0f5c99d49392d05a56663d6b9f9a173690e2e341a3f4a4f9
@@ -51,9 +51,14 @@ module GraphQL
51
51
  GraphQL::Models::DefinitionHelpers.load_and_traverse(starting_model, path, context)
52
52
  end
53
53
 
54
- def self.load_relation(relation)
55
- request = RelationLoadRequest.new(relation)
56
- request.load
54
+ def self.load_relation(relation, fast_query: false)
55
+ if fast_query
56
+ request = AttributeLoader::Request.new(relation.where_values_hash, Helpers.orders_to_sql(relation.orders))
57
+ AttributeLoader.for(relation.klass).load(request)
58
+ else
59
+ request = RelationLoadRequest.new(relation)
60
+ request.load
61
+ end
57
62
  end
58
63
 
59
64
  def self.field_info(graph_type, field_name)
@@ -10,17 +10,17 @@ module GraphQL::Models::HashCombiner
10
10
  private
11
11
 
12
12
  def combine_core(hashes, keys)
13
- return [] if keys.blank?
13
+ return [] if keys.nil? || keys.empty?
14
14
 
15
15
  # If there's only one key in each of the hashes, then combine that into a single hash with an array
16
16
  if keys.length == 1
17
17
  values = hashes.map { |h| h[keys[0]] }
18
- return [{ keys[0] => values.uniq }]
18
+ return [{ keys[0] => values.flatten.uniq }]
19
19
  end
20
20
 
21
21
  # Get the most commonly occuring value in the hash, and remove it from the keys.
22
22
  # Return one hash for each unique value.
23
- min_key = keys.min_by { |k| hashes.map { |h| h[k] }.uniq.count }
23
+ min_key = keys.min_by { |k| hashes.map { |h| h[k] }.flatten.uniq.count }
24
24
  inner_keys = keys.dup
25
25
  inner_keys.delete(min_key)
26
26
 
@@ -1,5 +1,5 @@
1
1
  module GraphQL
2
2
  module Models
3
- VERSION = "0.7.0"
3
+ VERSION = "0.7.1"
4
4
  end
5
5
  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.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Foster
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-08-26 00:00:00.000000000 Z
11
+ date: 2016-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -214,7 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
214
214
  version: '0'
215
215
  requirements: []
216
216
  rubyforge_project:
217
- rubygems_version: 2.4.8
217
+ rubygems_version: 2.5.1
218
218
  signing_key:
219
219
  specification_version: 4
220
220
  summary: ActiveRecord helpers for GraphQL + Relay