paranoia 2.5.3 → 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 +8 -0
- data/Gemfile +1 -1
- data/README.md +1 -1
- data/lib/paranoia/version.rb +1 -1
- data/lib/paranoia.rb +7 -5
- metadata +2 -2
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,5 +1,13 @@
|
|
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
|
+
|
3
11
|
## 2.5.3
|
4
12
|
|
5
13
|
* [#532](https://github.com/rubysherpas/paranoia/pull/532) Fix: correct bug when sentinel_value is not a timestamp
|
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/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
|
|
@@ -143,7 +145,7 @@ module Paranoia
|
|
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|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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
|
@@ -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.
|
109
|
+
rubygems_version: 3.1.6
|
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,
|