paranoia 2.6.2 → 2.6.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5435d5ed0b4879dda1edf99c6cebfa860d8ae87a7420dea64289b6f53fc48314
4
- data.tar.gz: af9635bbfa0477de0acf5cf18160b28e4f7e18ed0e41f551ae9e8a63146d3083
3
+ metadata.gz: 6f7493c138657c99cbb4eca5ed981c6bfac2400f18d34ad7fda9266ad672c39c
4
+ data.tar.gz: 4397c1ac47d8b67fb3db3a084bdaea2fec4d2ebe5c475c99b2914563e3011ae9
5
5
  SHA512:
6
- metadata.gz: 1a8b413670e0cfc193cb061ff7a9f4edec3765bfde3c4e3f37e43ecc0136f7adecf6ffb0ba5ee29791949e98b4a07daa0bdc58cbcd9c0ee30e13daddd9c4a3b9
7
- data.tar.gz: 893ade53cdf583809902904061b8deae5a337042b41df30c373937b29fa310ea9945dd494b35ae566d52005f672bf1d4529d458c684a12a0226a0197898a5b2d
6
+ metadata.gz: 5acd851f9180575136c06b5e6c44db7a7b53462771d77d722790062ca7e4e2482e2938f35471b54d472f68c1d92b372334b3c269931d997bdd4562c5904ea800
7
+ data.tar.gz: 2efed9b375277b7c1d066499323fe23af8f1af9c139389c45f2688eeb231da1ab8584cd061ba49f66130af4751263eb52458d8d2f68ae1057765437cdc320811
@@ -15,11 +15,13 @@ jobs:
15
15
  strategy:
16
16
  fail-fast: false
17
17
  matrix:
18
- rails: ["~> 7.0.0", "~> 6.1.0", "~> 6.0.0"]
18
+ rails: ["~> 7.1.0", "~> 7.0.0", "~> 6.1.0", "~> 6.0.0"]
19
19
  ruby: ["3.2.2", "3.1.4", "3.0.6", "2.7.8"]
20
20
  include:
21
21
  - ruby: 3.2
22
22
  rails: 'edge'
23
+ - ruby: 3.2
24
+ rails: '~> 7.1.0'
23
25
  # single test failure with jruby
24
26
  #- ruby: jruby-9.4
25
27
  # rails: '~> 7.0.0'
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # paranoia Changelog
2
2
 
3
+ ## 2.6.3
4
+
5
+ * [#548](https://github.com/rubysherpas/paranoia/pull/441) Add support for [Rails 7.1](https://github.com/rails/rails/releases/tag/v7.1.0) (#441)
6
+
7
+ [Indyarocks](https://github.com/indyarocks)
8
+
3
9
  ## 2.6.2
4
10
 
5
11
  * [#441](https://github.com/rubysherpas/paranoia/pull/441) Recursive restore with has_many/one through assocs (#441)
@@ -1,3 +1,3 @@
1
1
  module Paranoia
2
- VERSION = '2.6.2'.freeze
2
+ VERSION = '2.6.3'.freeze
3
3
  end
data/lib/paranoia.rb CHANGED
@@ -60,7 +60,7 @@ module Paranoia
60
60
  def paranoia_destroy
61
61
  with_transaction_returning_status do
62
62
  result = run_callbacks(:destroy) do
63
- @_disable_counter_cache = deleted?
63
+ @_disable_counter_cache = paranoia_destroyed?
64
64
  result = paranoia_delete
65
65
  next result unless result && ActiveRecord::VERSION::STRING >= '4.2'
66
66
  each_counter_cached_associations do |association|
@@ -73,7 +73,7 @@ module Paranoia
73
73
  @_disable_counter_cache = false
74
74
  result
75
75
  end
76
- raise ActiveRecord::Rollback, "Not destroyed" unless self.deleted?
76
+ raise ActiveRecord::Rollback, "Not destroyed" unless paranoia_destroyed?
77
77
  result
78
78
  end || false
79
79
  end
@@ -216,23 +216,12 @@ module Paranoia
216
216
  end
217
217
 
218
218
  if association_data.nil? && association.macro.to_s == "has_one"
219
- association_class_name = association.klass.name
220
-
221
- association_foreign_key = if association.options[:through].present?
222
- association.klass.primary_key
223
- else
224
- association.foreign_key
225
- end
226
-
227
- if association.type
228
- association_polymorphic_type = association.type
229
- association_find_conditions = { association_polymorphic_type => self.class.name.to_s, association_foreign_key => self.id }
230
- else
231
- association_find_conditions = { association_foreign_key => self.id }
232
- end
233
-
234
219
  association_class = association.klass
235
220
  if association_class.paranoid?
221
+ association_foreign_key = association.options[:through].present? ? association.klass.primary_key : association.foreign_key
222
+ association_find_conditions = { association_foreign_key => self.id }
223
+ association_find_conditions[association.type] = self.class.name if association.type
224
+
236
225
  association_class.only_deleted.where(association_find_conditions).first
237
226
  .try!(:restore, recursive: true, :recovery_window_range => recovery_window_range)
238
227
  end
data/paranoia.gemspec CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.license = 'MIT'
12
12
  s.summary = "Paranoia is a re-implementation of acts_as_paranoid for Rails 3, 4, and 5, using much, much, much less code."
13
13
  s.description = <<-DSC
14
- Paranoia is a re-implementation of acts_as_paranoid for Rails 4, 5, 6, and 7,
14
+ Paranoia is a re-implementation of acts_as_paranoid for Rails 5, 6, and 7,
15
15
  using much, much, much less code. You would use either plugin / gem if you
16
16
  wished that when you called destroy on an Active Record object that it
17
17
  didn't actually destroy it, but just "hid" the record. Paranoia does this
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
24
24
 
25
25
  s.required_ruby_version = '>= 2.5'
26
26
 
27
- s.add_dependency 'activerecord', '>= 5.1', '< 7.1'
27
+ s.add_dependency 'activerecord', '>= 5.1', '< 7.2'
28
28
 
29
29
  s.add_development_dependency "bundler", ">= 1.0.0"
30
30
  s.add_development_dependency "rake"
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.2
4
+ version: 2.6.3
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: 2023-06-05 00:00:00.000000000 Z
11
+ date: 2023-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '5.1'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '7.1'
22
+ version: '7.2'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '5.1'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '7.1'
32
+ version: '7.2'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: bundler
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -59,7 +59,7 @@ dependencies:
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0'
61
61
  description: |2
62
- Paranoia is a re-implementation of acts_as_paranoid for Rails 4, 5, 6, and 7,
62
+ Paranoia is a re-implementation of acts_as_paranoid for Rails 5, 6, and 7,
63
63
  using much, much, much less code. You would use either plugin / gem if you
64
64
  wished that when you called destroy on an Active Record object that it
65
65
  didn't actually destroy it, but just "hid" the record. Paranoia does this
@@ -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.11
109
+ rubygems_version: 3.4.18
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,