soft_deleter 0.3.1 → 0.5.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1075ffd8808a9f4fd6ccb64b965ffe966a4a8a3708ac128a8005a88522b10f5b
4
- data.tar.gz: f3897475f6af066ac4539c4ef3d8ba9f6a6e097075b9053bbc47532077c4b6b4
3
+ metadata.gz: 672ec5654bf0b0945ef9e11fc8647e9e89f8ba8ac12cada09c2c4d7a9c83efa9
4
+ data.tar.gz: dbb64ee715576e1b3df6a1ef1904bf9860002d239f955cac4f87745a3b8e4bd3
5
5
  SHA512:
6
- metadata.gz: 1f609a071a3ce88e348e4f82101411d4b6dbf9bbaaa88dd088c3543bc4ddf257c07aac5224b26d34c3e22ba18261e3c4bfc9a4d873fa5b47231ee9cb63d56b7b
7
- data.tar.gz: 8fcc88756079ff57e9af970b4a3fa2cf37f0938f38fd8789735a157749a08504436da792c8e23daa9124da22523f169d4eb2471ed7976529a9a8317d7c5390e6
6
+ metadata.gz: 32388dbec9f06cf44d7f4f121856829e180b730b1023b34a481db45e167166c61a811fe6f1709a63f7ba7cb4101fbf4ce1eac2157fbf7dbb39a689845921dad2
7
+ data.tar.gz: 413a1b35010bbb8387910f15228e67e9b2324ee773f14cdf133f057a0e40f2d567c43899f404a6dae85dee5af368dd7f1aafc65cdc25ebdc8766f35bc3812a54
@@ -1,3 +1,3 @@
1
1
  module SoftDeleter
2
- VERSION = "0.3.1"
2
+ VERSION = "0.5.1"
3
3
  end
data/lib/soft_deleter.rb CHANGED
@@ -14,7 +14,7 @@ module SoftDeleter
14
14
  result = %i[has_many has_one].map { |a| self.reflect_on_all_associations(a) }.flatten.filter_map do |i|
15
15
  next unless %i[destroy delete delete_all].include?(i.options[:dependent]) && i.options.keys.exclude?(:through)
16
16
 
17
- i.options[:class_name]&.underscore&.pluralize&.to_sym || i.name
17
+ i.name || i.options[:class_name]&.underscore&.pluralize&.to_sym
18
18
  end.compact
19
19
  result - [:"active_storage/attachments"]
20
20
  end
@@ -80,7 +80,13 @@ module SoftDeleter
80
80
  self.send(child_table)
81
81
  end.flatten
82
82
 
83
- childs.compact.each { |child| child.with_associations(callback, deleter) }
83
+ childs.compact.each do |child|
84
+ if child.respond_to?(:with_associations, true)
85
+ child.with_associations(callback, deleter)
86
+ else
87
+ child.send(:"destroy#{callback.to_s.last == "!" ? "!" : ""}")
88
+ end
89
+ end
84
90
 
85
91
  send(callback, deleter) if deleter.present?
86
92
  send(callback) if deleter.blank?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soft_deleter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - testCodeV01
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-22 00:00:00.000000000 Z
11
+ date: 2024-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails