soft_deletion 1.10.0 → 1.12.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: 558cebd07c91a09e4e4c8ed9666ec2e69f976f683638808587dd82a14a26b1a0
4
- data.tar.gz: 70c40697c87ab55a54631b6157b60931e0955fd41a2211ab8d03a4560b790e0b
3
+ metadata.gz: 24466acf8a31d8d66e69516ff6714f32cd10b3e8c3c093007d93e3f4bb5974eb
4
+ data.tar.gz: 57b97455f434d22a9a6c1bb751299a17d0d7e3258f26dcf42fc23e3fbf127137
5
5
  SHA512:
6
- metadata.gz: 188f18ba4882573c43409d0459bfd5f8241309d442d5cc4c928c15751952996851616b469b6ba4d40381d16d215a06d2bb80496044cf9efdcd5a37af9c1a9b3d
7
- data.tar.gz: 2ea4e5a90ff792fad51ea8798d50ec96e1bb3099dde6cdf37a04775752e57220d43b6bc10370be1510280d738453e69de7da144d82e782fde4d2af45f1f12d20
6
+ metadata.gz: d2f0cefd7031edd4bf235b1026a5cb5cd0585b3cb2db4d22dc83102a3869c1eee8cd3921df2769ca94f49c596881920c311992550795374105c731d2e7ba8ea8
7
+ data.tar.gz: 82f93c985c8db9b69749a78e65c55e30f5857f338d62685501a8bc9a7c9c034e8724c8b3a455d7612fb98d98c15fcde51d9eb529930f203df56567cd4eb2aee9
data/Readme.md CHANGED
@@ -44,6 +44,26 @@ user.products.count == 10
44
44
 
45
45
  # soft delete many
46
46
  User.soft_delete_all!(1,2,3,4)
47
+
48
+ # get soft deleted records
49
+ User.soft_deleted
50
+ ```
51
+
52
+ To add the `deleted_at` to your model, you can either generate a migration using:
53
+
54
+ ```
55
+ rails generate migration add_deleted_at_to_users deleted_at:datetime:index
56
+ ```
57
+
58
+ or create a migration file yourself like:
59
+
60
+ ```Ruby
61
+ class AddDeletedAtToUsers < ActiveRecord::Migration[6.0]
62
+ def change
63
+ add_column :users, :deleted_at, :datetime
64
+ add_index :users, :deleted_at
65
+ end
66
+ end
47
67
  ```
48
68
 
49
69
  TODO
@@ -62,6 +82,7 @@ Authors
62
82
  - [Oliver Nightingale](https://github.com/olivernn)
63
83
  - [Kumar Pandya](https://github.com/kpandya91)
64
84
  - [Alex Pauly](https://github.com/apauly)
85
+ - [Yaroslav](https://github.com/viralpraxis)
65
86
 
66
87
  [Zendesk](http://zendesk.com)<br/>
67
88
  michael@grosser.it<br/>
@@ -26,6 +26,10 @@ module SoftDeletion
26
26
  Thread.current[key] = nil
27
27
  end
28
28
 
29
+ def soft_deleted
30
+ with_deleted { where.not(deleted_at: nil) }
31
+ end
32
+
29
33
  def mark_as_soft_deleted_sql
30
34
  { deleted_at: Time.now }
31
35
  end
@@ -1,3 +1,3 @@
1
1
  module SoftDeletion
2
- VERSION = '1.10.0'
2
+ VERSION = '1.12.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soft_deletion
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.0
4
+ version: 1.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-14 00:00:00.000000000 Z
11
+ date: 2024-11-25 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.0.0
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '7.3'
22
+ version: '8.1'
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.0.0
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '7.3'
32
+ version: '8.1'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rake
35
35
  requirement: !ruby/object:Gem::Requirement