paper_trail-association_tracking 2.1.1 → 2.1.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51f0ba0d9f3c256f374002822d5f7e88444b6be465dd2189c8107d90160ed457
|
4
|
+
data.tar.gz: 046c163be73401cc97d593b48fc8a6fb91e09480303c6ab00df3f7818fc25ddd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0e720740047a827254138caa7d8019d2ca29f5a4ee1a53fd7cc51f93d8a04998f2c8f661415840bc379f4196673347e35656f18fc2c70d14809fd47b9532f6b
|
7
|
+
data.tar.gz: dd3e7ecc22c067f5f60fe0fd1d21a7997bb91e62ed39955ac2a337cce83071617d93c2f49ec70f0a6de96c37efe6625041a4b0e3e2c57739c7b2ef30bbe135c9
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,15 @@
|
|
4
4
|
|
5
5
|
- Nothing yet
|
6
6
|
|
7
|
+
### 2.1.3 - [View Diff](https://github.com/westonganger/paper_trail-association_tracking/compare/v2.1.1...v2.1.3)
|
8
|
+
|
9
|
+
- [PR #24](https://github.com/westonganger/paper_trail-association_tracking/pull/24) - Fix reification on STI models that have parent child relationships
|
10
|
+
- Last version that is compatible with `paper_trail` due to the change in the loading mechanism
|
11
|
+
|
12
|
+
### 2.1.2
|
13
|
+
|
14
|
+
- Release yanked, had bug preventing installation
|
15
|
+
|
7
16
|
### 2.1.1 - 2020-10-21 - [View Diff](https://github.com/westonganger/paper_trail-association_tracking/compare/v2.1.0...v2.1.1)
|
8
17
|
|
9
18
|
- Bug fix for reify on `has_many :through` relationships when `:source` is specified
|
@@ -94,12 +94,18 @@ module PaperTrailAssociationTracking
|
|
94
94
|
# from the point in time identified by `tx_id` or `version_at`.
|
95
95
|
# @api private
|
96
96
|
def load_versions_for_hm_association(assoc, model, version_table, tx_id, version_at)
|
97
|
+
# For STI models, associations may be defined to reference superclasses, so looking up
|
98
|
+
# based on only the child-most class is not appropriate.
|
99
|
+
sti_model_names = model.class.ancestors
|
100
|
+
.select { |x| x <= model.class.base_class && x.method_defined?(assoc.name) }
|
101
|
+
.map(&:name)
|
102
|
+
|
97
103
|
version_ids = ::PaperTrail::VersionAssociation.
|
98
104
|
joins(model.class.version_association_name).
|
99
105
|
select("MIN(version_id) as version_id").
|
100
106
|
where("foreign_key_name = ?", assoc.foreign_key).
|
101
107
|
where("foreign_key_id = ?", model.id).
|
102
|
-
where(foreign_type: [
|
108
|
+
where(foreign_type: sti_model_names + [nil]).
|
103
109
|
where("#{version_table}.item_type = ?", assoc.klass.base_class.name).
|
104
110
|
where("created_at >= ? OR transaction_id = ?", version_at, tx_id).
|
105
111
|
group("item_id").
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paper_trail-association_tracking
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Weston Ganger
|
@@ -10,8 +10,22 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2021-04-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: paper_trail
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - "<"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '12.0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - "<"
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '12.0'
|
15
29
|
- !ruby/object:Gem::Dependency
|
16
30
|
name: appraisal
|
17
31
|
requirement: !ruby/object:Gem::Requirement
|