pragma-decorator 2.2.2 → 2.2.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: 8bb3d13a9c56f66c118d61a10b39ec6c747085e668b56a43506d1e4a98df3642
4
- data.tar.gz: 124016af425c1c97362816995a381d6fed4933c4f6a2b94aa7876a5dadbbb011
3
+ metadata.gz: d1f2bd7c761c330889bdc0ade7c83f1e9cd6921fc8c81d5b5fc3352bfdc114a9
4
+ data.tar.gz: d2bf1594ada1c8793dee81d0bccb0768ad24b8e6b2a797c148e247c0bde2e4be
5
5
  SHA512:
6
- metadata.gz: 699a8306445e1849e2d4665f516747e0239fd4388abf27990efcfceaef6cfb71da37224a7418a2a8cbd8918cd60f9c4f82594b4e49c569848506a1e12ecf699a
7
- data.tar.gz: 15d9195932dd144757582d004f32f0c4e2f873860944f1009160fe60bf55183b6b8fa394d62ef4779d0871d824000d68105d44ca307cd3060ba3b0ecc13b3f68
6
+ metadata.gz: e149d329a44e39fe7004bd5a79a5612ef2ef8dd9cf0893f871d009ffe47ebb759ad39ee10d98947a3a11948b9403ce1dd0038f93c8940d9dcf6253cb85fc236a
7
+ data.tar.gz: f879896b77db56e45224138a0e0f59289a7ddf8e602d4b4f876ebb7a60fa04a69b57bba64fc7bc93c1a8aa3f6fd064c0e715b129faa4ca84dc03b377b826d0aa
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.2.3]
11
+
12
+ ### Fixed
13
+
14
+ - Fixed an issue with the loading of polymorphic associations
15
+
10
16
  ## [2.2.2]
11
17
 
12
18
  ### Fixed
@@ -69,7 +75,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
69
75
  First Pragma 2 release.
70
76
 
71
77
  [Unreleased]: https://github.com/pragmarb/pragma-decorator/compare/v2.2.2...HEAD
72
- [2.2.1]: https://github.com/pragmarb/pragma-decorator/compare/v2.2.1...v2.2.2
78
+ [2.2.3]: https://github.com/pragmarb/pragma-decorator/compare/v2.2.2...v2.2.3
79
+ [2.2.2]: https://github.com/pragmarb/pragma-decorator/compare/v2.2.1...v2.2.2
73
80
  [2.2.1]: https://github.com/pragmarb/pragma-decorator/compare/v2.2.0...v2.2.1
74
81
  [2.2.0]: https://github.com/pragmarb/pragma-decorator/compare/v2.1.1...v2.2.0
75
82
  [2.1.1]: https://github.com/pragmarb/pragma-decorator/compare/v2.1.0...v2.1.1
@@ -91,8 +91,14 @@ module Pragma
91
91
  private
92
92
 
93
93
  def compute_belongs_to_fk
94
+ primary_key = if association_reflection.polymorphic?
95
+ association_reflection.options[:primary_key] || associated_object.class.primary_key
96
+ else
97
+ association_reflection.association_primary_key
98
+ end
99
+
94
100
  if model.association(reflection.property).loaded?
95
- return associated_object&.public_send(association_reflection.association_primary_key)
101
+ return associated_object&.public_send(primary_key)
96
102
  end
97
103
 
98
104
  if association_reflection.scope.nil?
@@ -101,7 +107,7 @@ module Pragma
101
107
 
102
108
  pluck_association_fk do |scope|
103
109
  fk = model.public_send(association_reflection.foreign_key)
104
- scope.where(association_reflection.association_primary_key => fk)
110
+ scope.where(primary_key => fk)
105
111
  end
106
112
  end
107
113
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Pragma
4
4
  module Decorator
5
- VERSION = '2.2.2'
5
+ VERSION = '2.2.3'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pragma-decorator
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alessandro Desantis
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-02-28 00:00:00.000000000 Z
11
+ date: 2018-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: roar
@@ -194,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
194
194
  version: '0'
195
195
  requirements: []
196
196
  rubyforge_project:
197
- rubygems_version: 2.7.5
197
+ rubygems_version: 2.7.4
198
198
  signing_key:
199
199
  specification_version: 4
200
200
  summary: Convert your API resources into JSON with minimum hassle.