paranoia 2.6.1 → 2.6.2

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: 7f3f587b5571dc6b69507b4b97de85c0c851bfe248048dbcc2ff792d578ebbca
4
- data.tar.gz: ba5bb9bde79c1be27152df53d2d0be62e852b5e3801cb71d1b2b33fe8bfb9f6b
3
+ metadata.gz: 5435d5ed0b4879dda1edf99c6cebfa860d8ae87a7420dea64289b6f53fc48314
4
+ data.tar.gz: af9635bbfa0477de0acf5cf18160b28e4f7e18ed0e41f551ae9e8a63146d3083
5
5
  SHA512:
6
- metadata.gz: 42caeef276dfc15bcc15ca8fbd2dc8001ca7e24c3577d235d12bfa8cb175b082a4d585c07e4244f2d76acb9c49127c113a7f567bea7c60514a475cf3791ac789
7
- data.tar.gz: 6655a5f44f71fe45e7df8df13545acd8706a8f105bece1e838c77722fbd8fe20ae6596f0e3961976b3bd2a3ed38c5a055230500c30599f8499d845be61c22a60
6
+ metadata.gz: 1a8b413670e0cfc193cb061ff7a9f4edec3765bfde3c4e3f37e43ecc0136f7adecf6ffb0ba5ee29791949e98b4a07daa0bdc58cbcd9c0ee30e13daddd9c4a3b9
7
+ data.tar.gz: 893ade53cdf583809902904061b8deae5a337042b41df30c373937b29fa310ea9945dd494b35ae566d52005f672bf1d4529d458c684a12a0226a0197898a5b2d
@@ -15,40 +15,30 @@ jobs:
15
15
  strategy:
16
16
  fail-fast: false
17
17
  matrix:
18
- ruby:
19
- - 3.1
20
- - '3.0'
21
- - 2.7
22
- - 2.6
23
- - 2.5
24
- # - jruby-9.2.19.0
25
- # - jruby-9.3.1.0
26
- rails:
27
- - '~> 5.1.0'
28
- - '~> 5.2.0'
29
- - '~> 6.0.0'
30
- - '~> 6.1.0'
31
- - '~> 7.0.0'
32
- - 'edge'
33
- exclude:
34
- # Rails edge is now 7.x and requires ruby 2.7
35
- - rails: 'edge'
36
- ruby: 2.6
37
- - rails: 'edge'
38
- ruby: 2.5
39
- - rails: '~> 7.0.0'
40
- ruby: 2.6
41
- - rails: '~> 7.0.0'
42
- ruby: 2.5
43
- # Legacy Rails with newer rubies
44
- - rails: '~> 5.1.0'
45
- ruby: '3.0'
46
- - rails: '~> 5.2.0'
47
- ruby: '3.0'
48
- - rails: '~> 5.1.0'
49
- ruby: 3.1
50
- - rails: '~> 5.2.0'
51
- ruby: 3.1
18
+ rails: ["~> 7.0.0", "~> 6.1.0", "~> 6.0.0"]
19
+ ruby: ["3.2.2", "3.1.4", "3.0.6", "2.7.8"]
20
+ include:
21
+ - ruby: 3.2
22
+ rails: 'edge'
23
+ # single test failure with jruby
24
+ #- ruby: jruby-9.4
25
+ # rails: '~> 7.0.0'
26
+ - ruby: 2.6
27
+ rails: '~> 6.1.0'
28
+ - ruby: 2.6
29
+ rails: '~> 6.0.0'
30
+ - ruby: 2.6
31
+ rails: '~> 5.2.0'
32
+ - ruby: 2.6
33
+ rails: '~> 5.1.0'
34
+ - ruby: 2.5
35
+ rails: '~> 6.0.0'
36
+ - ruby: 2.5
37
+ rails: '~> 5.2.0'
38
+ - ruby: 2.5
39
+ rails: '~> 5.1.0'
40
+ #os: ubuntu-latest
41
+ #arch: x64
52
42
 
53
43
  env:
54
44
  RAILS: ${{ matrix.rails }}
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # paranoia Changelog
2
2
 
3
+ ## 2.6.2
4
+
5
+ * [#441](https://github.com/rubysherpas/paranoia/pull/441) Recursive restore with has_many/one through assocs (#441)
6
+ [Emil Ong](https://github.com/emilong)
7
+
3
8
  ## 2.6.1
4
9
 
5
10
  * [#535](https://github.com/rubysherpas/paranoia/pull/535) Allow to skip updating paranoia_destroy_attributes for records while really_destroy!
@@ -1,3 +1,3 @@
1
1
  module Paranoia
2
- VERSION = '2.6.1'.freeze
2
+ VERSION = '2.6.2'.freeze
3
3
  end
data/lib/paranoia.rb CHANGED
@@ -217,7 +217,12 @@ module Paranoia
217
217
 
218
218
  if association_data.nil? && association.macro.to_s == "has_one"
219
219
  association_class_name = association.klass.name
220
- association_foreign_key = association.foreign_key
220
+
221
+ association_foreign_key = if association.options[:through].present?
222
+ association.klass.primary_key
223
+ else
224
+ association.foreign_key
225
+ end
221
226
 
222
227
  if association.type
223
228
  association_polymorphic_type = association.type
@@ -226,7 +231,7 @@ module Paranoia
226
231
  association_find_conditions = { association_foreign_key => self.id }
227
232
  end
228
233
 
229
- association_class = association_class_name.constantize
234
+ association_class = association.klass
230
235
  if association_class.paranoid?
231
236
  association_class.only_deleted.where(association_find_conditions).first
232
237
  .try!(:restore, recursive: true, :recovery_window_range => recovery_window_range)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paranoia
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.1
4
+ version: 2.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - radarlistener@gmail.com
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-15 00:00:00.000000000 Z
11
+ date: 2023-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  - !ruby/object:Gem::Version
107
107
  version: 1.3.6
108
108
  requirements: []
109
- rubygems_version: 3.4.0.dev
109
+ rubygems_version: 3.4.11
110
110
  signing_key:
111
111
  specification_version: 4
112
112
  summary: Paranoia is a re-implementation of acts_as_paranoid for Rails 3, 4, and 5,