paranoia 2.6.0 → 2.6.1

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: ad52996a9a12b6605d8179ad1ae5ef39cb7655d19d037884518800a02f6ff160
4
- data.tar.gz: 3c9d2c4203e203b64bf0e24db1995ddfc431c8ed742ad96319f19eea2a62bc8a
3
+ metadata.gz: 7f3f587b5571dc6b69507b4b97de85c0c851bfe248048dbcc2ff792d578ebbca
4
+ data.tar.gz: ba5bb9bde79c1be27152df53d2d0be62e852b5e3801cb71d1b2b33fe8bfb9f6b
5
5
  SHA512:
6
- metadata.gz: ed7a78d7135fce0a513e0f5fb4c6c685c99ad788efa57e15dd9ae011d1dfce0d98bc41fd49b7688f3d706e6101b78824ada19ce3617359a085186e76acc0a2db
7
- data.tar.gz: 2a24bfb1f5d1f9b8c5e588c86bf745ed80125167dfefc6ad5a10cc3b7a66da3ee50f85b7727cda74a5f92a9a1d1b3fac0defc4296b71b1dd7f8c9e9d8496831f
6
+ metadata.gz: 42caeef276dfc15bcc15ca8fbd2dc8001ca7e24c3577d235d12bfa8cb175b082a4d585c07e4244f2d76acb9c49127c113a7f567bea7c60514a475cf3791ac789
7
+ data.tar.gz: 6655a5f44f71fe45e7df8df13545acd8706a8f105bece1e838c77722fbd8fe20ae6596f0e3961976b3bd2a3ed38c5a055230500c30599f8499d845be61c22a60
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # paranoia Changelog
2
2
 
3
+ ## 2.6.1
4
+
5
+ * [#535](https://github.com/rubysherpas/paranoia/pull/535) Allow to skip updating paranoia_destroy_attributes for records while really_destroy!
6
+ [Anton Bogdanov](https://github.com/kortirso)
7
+
3
8
  ## 2.6.0
4
9
 
5
10
  * [#512](https://github.com/rubysherpas/paranoia/pull/512) Quote table names; Mysql 8 has keywords that might match table names which cause an exception.
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/paranoia.svg)](https://badge.fury.io/rb/paranoia)
2
2
  [![build](https://github.com/rubysherpas/paranoia/actions/workflows/build.yml/badge.svg)](https://github.com/rubysherpas/paranoia/actions/workflows/build.yml)
3
3
 
4
- **Notice:**
4
+ **Notice:**
5
5
 
6
6
  `paranoia` has some surprising behaviour (like overriding ActiveRecord's `delete` and `destroy`) and is not recommended for new projects. See [`discard`'s README](https://github.com/jhawthorn/discard#why-not-paranoia-or-acts_as_paranoid) for more details.
7
7
 
@@ -103,6 +103,14 @@ If you really want it gone *gone*, call `really_destroy!`:
103
103
  # => client
104
104
  ```
105
105
 
106
+ If you need skip updating timestamps for deleting records, call `really_destroy!(update_destroy_attributes: false)`.
107
+ When we call `really_destroy!(update_destroy_attributes: false)` on the parent `client`, then each child `email` will also have `really_destroy!(update_destroy_attributes: false)` called.
108
+
109
+ ``` ruby
110
+ >> client.really_destroy!(update_destroy_attributes: false)
111
+ # => client
112
+ ```
113
+
106
114
  If you want to use a column other than `deleted_at`, you can pass it as an option:
107
115
 
108
116
  ``` ruby
@@ -1,3 +1,3 @@
1
1
  module Paranoia
2
- VERSION = '2.6.0'.freeze
2
+ VERSION = '2.6.1'.freeze
3
3
  end
data/lib/paranoia.rb CHANGED
@@ -144,7 +144,7 @@ module Paranoia
144
144
  end
145
145
  alias :deleted? :paranoia_destroyed?
146
146
 
147
- def really_destroy!
147
+ def really_destroy!(update_destroy_attributes: true)
148
148
  with_transaction_returning_status do
149
149
  run_callbacks(:real_destroy) do
150
150
  @_disable_counter_cache = paranoia_destroyed?
@@ -158,12 +158,14 @@ module Paranoia
158
158
  # .paranoid? will work for both instances and classes
159
159
  next unless association_data && association_data.paranoid?
160
160
  if reflection.collection?
161
- next association_data.with_deleted.each(&:really_destroy!)
161
+ next association_data.with_deleted.find_each { |record|
162
+ record.really_destroy!(update_destroy_attributes: update_destroy_attributes)
163
+ }
162
164
  end
163
- association_data.really_destroy!
165
+ association_data.really_destroy!(update_destroy_attributes: update_destroy_attributes)
164
166
  end
165
167
  end
166
- update_columns(paranoia_destroy_attributes)
168
+ update_columns(paranoia_destroy_attributes) if update_destroy_attributes
167
169
  destroy_without_paranoia
168
170
  end
169
171
  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.6.0
4
+ version: 2.6.1
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-03-23 00:00:00.000000000 Z
11
+ date: 2022-11-15 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
@@ -106,8 +106,8 @@ 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.1.6
110
- signing_key:
109
+ rubygems_version: 3.4.0.dev
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.