api-blocks 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/api_blocks/blueprinter/association_extractor.rb +8 -2
- data/lib/api_blocks/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 262e7aba0eb7345352be66fe827ddef791af0b4f4e51415d306c074c85726974
|
4
|
+
data.tar.gz: f269687cb7321f5e9bd395a6cee371c109ec4066bd7ee55810785de31177c3d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc6e3f37f652765693ce3e2454b09695d032706b248407066e6b39b44d88e7a29c7176a124cfd7488bdc65b0d788eb1f3aefa7f73cb38b23d8a913730879ae1c
|
7
|
+
data.tar.gz: b6a3493ca7309b6acba7d9cfb60f0097e4a4332500fa0a58b1bfac7ffc69a4a07c9ec415ed0f1878c10a95a033daca820bce6cccb51add09cfce9620b54a792e
|
@@ -7,13 +7,19 @@
|
|
7
7
|
# `options[:blueprint]`
|
8
8
|
#
|
9
9
|
class Blueprinter::AssociationExtractor < Blueprinter::Extractor
|
10
|
+
alias_method :original_extract, :extract
|
11
|
+
|
10
12
|
def extract(association_name, object, local_options, options = {})
|
13
|
+
association = object.association(association_name)
|
14
|
+
|
15
|
+
if association.is_a?(ActiveRecord::Associations::HasManyThroughAssociation)
|
16
|
+
return original_extract(association_name, object, local_optins, options)
|
17
|
+
end
|
18
|
+
|
11
19
|
if options[:blueprint].is_a?(Proc)
|
12
20
|
raise "Cannot load blueprints with a `proc` blueprint option with batch-loader"
|
13
21
|
end
|
14
22
|
|
15
|
-
association = object.association(association_name)
|
16
|
-
|
17
23
|
join_key = association.reflection.join_keys
|
18
24
|
association_id = object.send(join_key.foreign_key)
|
19
25
|
association_klass = association.reflection.class_name
|
data/lib/api_blocks/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: api-blocks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul d'Hubert
|
@@ -305,7 +305,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
305
305
|
- !ruby/object:Gem::Version
|
306
306
|
version: '0'
|
307
307
|
requirements: []
|
308
|
-
rubygems_version: 3.0.
|
308
|
+
rubygems_version: 3.0.6
|
309
309
|
signing_key:
|
310
310
|
specification_version: 4
|
311
311
|
summary: Simple and consistent rails api extensions
|