api-blocks 0.5.2 → 0.5.3

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: 0b72da3ebf264ac4c4c6738030a77b3f8dc341fe667a682462eddac78708db71
4
- data.tar.gz: 1c6861ac8878c6e3e88615b321415498e2e39403cbf069c2ba1665aedba4871e
3
+ metadata.gz: 262e7aba0eb7345352be66fe827ddef791af0b4f4e51415d306c074c85726974
4
+ data.tar.gz: f269687cb7321f5e9bd395a6cee371c109ec4066bd7ee55810785de31177c3d4
5
5
  SHA512:
6
- metadata.gz: b0d201ce944c970e15ee00a5664d1ab05e466bd04db0f21abfd654d3ea871e0c4f9c2bb39420540a14cb099d56462b86d4709e70020881799e3d91ef328e3ac1
7
- data.tar.gz: b7d6f2b7fd9493392983d23d8f3760e50449ac0d376e99f0e8e97c2f376d3048daff135d6ce7515c655e1d03c3582ee22d5681f9f2c56813895109ea1cc33da6
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
@@ -2,5 +2,5 @@
2
2
 
3
3
  module ApiBlocks
4
4
  # Current version of ApiBlocks
5
- VERSION = "0.5.2"
5
+ VERSION = "0.5.3"
6
6
  end
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.2
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.3
308
+ rubygems_version: 3.0.6
309
309
  signing_key:
310
310
  specification_version: 4
311
311
  summary: Simple and consistent rails api extensions