delete_recursively 0.9.2 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/delete_recursively.rb +4 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87a42e8c61f945033a7d70c5be9b5d08e1002f47
|
4
|
+
data.tar.gz: 72ce8ee5ddbd3812f4613508f2025e843b1b37ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9834aae07555564f02a5e4b3f971404f56503652185c3f5c1e33a5931ca3622c973ad20d0291232fe4d58794dd5a19e8526ad035121ad2a92e9fb03c653472a2
|
7
|
+
data.tar.gz: 9fa49fa62dbabe053bcb983840f7b2f514adaf53aa33145f8459f0c155583150a49ad8a8b6605245b16e31e51cf9a92abe5d66f87b3cddf91ea9da118dac97cf
|
data/lib/delete_recursively.rb
CHANGED
@@ -63,7 +63,10 @@ module DeleteRecursively
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def self.all(record_class, criteria = {})
|
66
|
-
|
66
|
+
applicable_criteria = criteria.select do |column_name, _value|
|
67
|
+
record_class.column_names.include?(column_name.to_s)
|
68
|
+
end
|
69
|
+
record_class.delete_all(applicable_criteria)
|
67
70
|
record_class.reflect_on_all_associations.each do |reflection|
|
68
71
|
all(reflection.klass, criteria) if recurse_on?(reflection)
|
69
72
|
end
|