paranoia 2.5.1 → 2.6.0
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 +4 -4
- data/CHANGELOG.md +24 -4
- data/Gemfile +1 -1
- data/README.md +1 -1
- data/lib/paranoia/rspec.rb +2 -2
- data/lib/paranoia/version.rb +1 -1
- data/lib/paranoia.rb +13 -7
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad52996a9a12b6605d8179ad1ae5ef39cb7655d19d037884518800a02f6ff160
|
4
|
+
data.tar.gz: 3c9d2c4203e203b64bf0e24db1995ddfc431c8ed742ad96319f19eea2a62bc8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed7a78d7135fce0a513e0f5fb4c6c685c99ad788efa57e15dd9ae011d1dfce0d98bc41fd49b7688f3d706e6101b78824ada19ce3617359a085186e76acc0a2db
|
7
|
+
data.tar.gz: 2a24bfb1f5d1f9b8c5e588c86bf745ed80125167dfefc6ad5a10cc3b7a66da3ee50f85b7727cda74a5f92a9a1d1b3fac0defc4296b71b1dd7f8c9e9d8496831f
|
data/CHANGELOG.md
CHANGED
@@ -1,22 +1,42 @@
|
|
1
1
|
# paranoia Changelog
|
2
2
|
|
3
|
+
## 2.6.0
|
4
|
+
|
5
|
+
* [#512](https://github.com/rubysherpas/paranoia/pull/512) Quote table names; Mysql 8 has keywords that might match table names which cause an exception.
|
6
|
+
* [#476](https://github.com/rubysherpas/paranoia/pull/476) Fix syntax error in documentation.
|
7
|
+
* [#485](https://github.com/rubysherpas/paranoia/pull/485) Rollback transaction if destroy aborted.
|
8
|
+
* [#522](https://github.com/rubysherpas/paranoia/pull/522) Add failing tests for association with abort on destroy.
|
9
|
+
* [#513](https://github.com/rubysherpas/paranoia/pull/513) Fix create callback called on destroy.
|
10
|
+
|
11
|
+
## 2.5.3
|
12
|
+
|
13
|
+
* [#532](https://github.com/rubysherpas/paranoia/pull/532) Fix: correct bug when sentinel_value is not a timestamp
|
14
|
+
[Hassanin Ahmed](https://github.com/sas1ni69)
|
15
|
+
* [#531](https://github.com/rubysherpas/paranoia/pull/531) Added test case to reproduce bug introduce in v2.5.1
|
16
|
+
[Sherif Elkassaby](https://github.com/sherif-nedap)
|
17
|
+
* [#529](https://github.com/rubysherpas/paranoia/pull/529) Fix: Do not define a RSpec matcher when RSpec isn't present
|
18
|
+
[Sebastian Welther](https://github.com/swelther)
|
19
|
+
|
3
20
|
## 2.5.2
|
4
21
|
|
22
|
+
* [#526](https://github.com/rubysherpas/paranoia/pull/526) Do not include tests files in packaged gem
|
23
|
+
|
24
|
+
[Jason Fleetwood-Boldt](https://github.com/jasonfb)
|
5
25
|
* [#492](https://github.com/rubysherpas/paranoia/pull/492) Warn if acts_as_paranoid is called more than once on the same model
|
6
26
|
|
7
|
-
|
27
|
+
[Ignatius Reza](https://github.com/ignatiusreza)
|
8
28
|
|
9
29
|
## 2.5.1
|
10
30
|
|
11
31
|
* [#481](https://github.com/rubysherpas/paranoia/pull/481) Replaces hard coded `deleted_at` with `paranoia_column`.
|
12
32
|
|
13
|
-
|
33
|
+
[Hassanin Ahmed](https://github.com/sas1ni69)
|
14
34
|
|
15
35
|
## 2.5.0
|
16
36
|
|
17
37
|
* [#516](https://github.com/rubysherpas/paranoia/pull/516) Add support for ActiveRecord 7.0, drop support for EOL Ruby < 2.5 and Rails < 5.1
|
18
38
|
adding support for Rails 7
|
19
|
-
|
39
|
+
|
20
40
|
[Mathieu Jobin](https://github.com/mathieujobin)
|
21
41
|
* [#515](https://github.com/rubysherpas/paranoia/pull/515) Switch from Travis CI to GitHub Actions
|
22
42
|
|
@@ -28,7 +48,7 @@
|
|
28
48
|
|
29
49
|
[Jörg Schiller](https://github.com/joergschiller)
|
30
50
|
|
31
|
-
* [#483](https://github.com/rubysherpas/paranoia/pull/483) Update JRuby version to 9.2.8.0 + remove EOL Ruby 2.2
|
51
|
+
* [#483](https://github.com/rubysherpas/paranoia/pull/483) Update JRuby version to 9.2.8.0 + remove EOL Ruby 2.2
|
32
52
|
|
33
53
|
[Uwe Kubosch](https://github.com/donv)
|
34
54
|
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -193,7 +193,7 @@ client.restore(:recursive => true)
|
|
193
193
|
If you want to restore a record and only those dependently destroyed associated records that were deleted within 2 minutes of the object upon which they depend:
|
194
194
|
|
195
195
|
``` ruby
|
196
|
-
Client.restore(id, :recursive => true
|
196
|
+
Client.restore(id, :recursive => true, :recovery_window => 2.minutes)
|
197
197
|
# or
|
198
198
|
client.restore(:recursive => true, :recovery_window => 2.minutes)
|
199
199
|
```
|
data/lib/paranoia/rspec.rb
CHANGED
data/lib/paranoia/version.rb
CHANGED
data/lib/paranoia.rb
CHANGED
@@ -40,7 +40,7 @@ module Paranoia
|
|
40
40
|
# these will not match != sentinel value because "NULL != value" is
|
41
41
|
# NULL under the sql standard
|
42
42
|
# Scoping with the table_name is mandatory to avoid ambiguous errors when joining tables.
|
43
|
-
scoped_quoted_paranoia_column = "#{self.table_name}.#{connection.quote_column_name(paranoia_column)}"
|
43
|
+
scoped_quoted_paranoia_column = "#{connection.quote_table_name(self.table_name)}.#{connection.quote_column_name(paranoia_column)}"
|
44
44
|
with_deleted.where("#{scoped_quoted_paranoia_column} IS NULL OR #{scoped_quoted_paranoia_column} != ?", paranoia_sentinel_value)
|
45
45
|
end
|
46
46
|
alias_method :deleted, :only_deleted
|
@@ -58,8 +58,8 @@ module Paranoia
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def paranoia_destroy
|
61
|
-
|
62
|
-
run_callbacks(:destroy) do
|
61
|
+
with_transaction_returning_status do
|
62
|
+
result = run_callbacks(:destroy) do
|
63
63
|
@_disable_counter_cache = deleted?
|
64
64
|
result = paranoia_delete
|
65
65
|
next result unless result && ActiveRecord::VERSION::STRING >= '4.2'
|
@@ -73,7 +73,9 @@ module Paranoia
|
|
73
73
|
@_disable_counter_cache = false
|
74
74
|
result
|
75
75
|
end
|
76
|
-
|
76
|
+
raise ActiveRecord::Rollback, "Not destroyed" unless self.deleted?
|
77
|
+
result
|
78
|
+
end || false
|
77
79
|
end
|
78
80
|
alias_method :destroy, :paranoia_destroy
|
79
81
|
|
@@ -138,12 +140,12 @@ module Paranoia
|
|
138
140
|
end
|
139
141
|
|
140
142
|
def paranoia_destroyed?
|
141
|
-
|
143
|
+
paranoia_column_value != paranoia_sentinel_value
|
142
144
|
end
|
143
145
|
alias :deleted? :paranoia_destroyed?
|
144
146
|
|
145
147
|
def really_destroy!
|
146
|
-
|
148
|
+
with_transaction_returning_status do
|
147
149
|
run_callbacks(:real_destroy) do
|
148
150
|
@_disable_counter_cache = paranoia_destroyed?
|
149
151
|
dependent_reflections = self.class.reflections.select do |name, reflection|
|
@@ -296,12 +298,16 @@ ActiveSupport.on_load(:active_record) do
|
|
296
298
|
self.class.paranoia_column
|
297
299
|
end
|
298
300
|
|
301
|
+
def paranoia_column_value
|
302
|
+
send(paranoia_column)
|
303
|
+
end
|
304
|
+
|
299
305
|
def paranoia_sentinel_value
|
300
306
|
self.class.paranoia_sentinel_value
|
301
307
|
end
|
302
308
|
|
303
309
|
def deletion_time
|
304
|
-
|
310
|
+
paranoia_column_value.acts_like?(:time) ? paranoia_column_value : deleted_at
|
305
311
|
end
|
306
312
|
end
|
307
313
|
end
|
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.
|
4
|
+
version: 2.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- radarlistener@gmail.com
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -91,7 +91,7 @@ homepage: https://github.com/rubysherpas/paranoia
|
|
91
91
|
licenses:
|
92
92
|
- MIT
|
93
93
|
metadata: {}
|
94
|
-
post_install_message:
|
94
|
+
post_install_message:
|
95
95
|
rdoc_options: []
|
96
96
|
require_paths:
|
97
97
|
- lib
|
@@ -107,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
107
|
version: 1.3.6
|
108
108
|
requirements: []
|
109
109
|
rubygems_version: 3.1.6
|
110
|
-
signing_key:
|
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,
|
113
113
|
using much, much, much less code.
|