sequel-jsonapi_eager 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sequel/plugins/jsonapi_eager.rb +7 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13bb547d4eccf7b9927130bd38b548ddb09b2eca
|
4
|
+
data.tar.gz: a786f85116def2322dbc9bb940500de26deefcaa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a7723c767bbefec38306f5f17a568ae25814e3e49dec73f4542a6eb64c601c3f958739315c3c6fbc60bc0171224a0ef2e0ef5de8843de576acdf41b45b0692d
|
7
|
+
data.tar.gz: d17f01de07da288d7d9fe8e26d5da85810101780827b7914ba257c995489f1ebf5750e41904dc5754635f2637420739f832767afa99baa09048578be7272c88f
|
@@ -24,7 +24,13 @@ module Sequel
|
|
24
24
|
association_name, association_include = relationship.split(".", 2)
|
25
25
|
association_dataset = send("#{association_name}_dataset")
|
26
26
|
.jsonapi_eager(association_include.to_s)
|
27
|
-
|
27
|
+
association_reflection = self.class.association_reflections.fetch(association_name.to_sym)
|
28
|
+
|
29
|
+
if association_reflection[:type].to_s =~ /one$/
|
30
|
+
associations[association_name.to_sym] = association_dataset.all[0]
|
31
|
+
else
|
32
|
+
associations[association_name.to_sym] = association_dataset.all
|
33
|
+
end
|
28
34
|
end
|
29
35
|
|
30
36
|
self
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sequel-jsonapi_eager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Janko Marohnić
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sequel
|