paranoia 2.5.3 → 2.6.0

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: 5a82e404509dd15068040f391a794122bc66343af8def462f0eb4e37851b670f
4
- data.tar.gz: fe04b171c8d485c18a4d41b2603780dfe15efebe1b3fd72d2a9074d0463642ae
3
+ metadata.gz: ad52996a9a12b6605d8179ad1ae5ef39cb7655d19d037884518800a02f6ff160
4
+ data.tar.gz: 3c9d2c4203e203b64bf0e24db1995ddfc431c8ed742ad96319f19eea2a62bc8a
5
5
  SHA512:
6
- metadata.gz: e797a325e51bd15605087eae81c27c622df6b2b3e2c46466b6a3d2f4509e612a3712871e4140abb0530993b6773f59765cab1c10672572f3176c7e32401ecaab
7
- data.tar.gz: b040f4ea08e809a827172755f7913da31a93aa5a9f7207ac9626fa9dadf848e36b352eb7084687cbee3a553c7f33124e434d291c900ffca3cfbe1dba340d0fb3
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
@@ -20,7 +20,7 @@ if RUBY_ENGINE == 'rbx'
20
20
  end
21
21
  end
22
22
 
23
- rails = ENV['RAILS'] || '~> 5.2.0'
23
+ rails = ENV['RAILS'] || '~> 6.0.4'
24
24
 
25
25
  if rails == 'edge'
26
26
  gem 'rails', github: 'rails/rails'
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. :recovery_window => 2.minutes)
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
  ```
@@ -1,3 +1,3 @@
1
1
  module Paranoia
2
- VERSION = '2.5.3'.freeze
2
+ VERSION = '2.6.0'.freeze
3
3
  end
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
- transaction do
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
- end
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
- transaction do
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.5.3
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.2.32
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,