mm_soft_deleted 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mongo_mapper/soft_deleted.rb +9 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2cedeb19982d4aaf9e243a4827b2f441136b6872
|
4
|
+
data.tar.gz: 9f99c53a1dd1e5340dcea8f9877d5f5568356877
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee800caacd88f784b2fd18d0fff2cda58063f5a6de79e5570ab300496fe90550eb8ae23e045a5bd92c5377f1780931f9d4c8fe0ca989750192afe03d62172e70
|
7
|
+
data.tar.gz: 4cc2f05716f41f7427c7af016b1cfe2822eb898a29d0e71c030bb890fa536ff2dbacff4ab061c3a10e6d799df52c9527bbfb71dcc1eccae6badfc41835f16075
|
@@ -9,12 +9,20 @@ class SoftDeletedRecord
|
|
9
9
|
end
|
10
10
|
|
11
11
|
module MongoMapper::SoftDeleted
|
12
|
+
class << self
|
13
|
+
def enabled?
|
14
|
+
instance_variable_defined?(:@enabled) ? @enabled : true
|
15
|
+
end
|
16
|
+
|
17
|
+
attr_writer :enabled
|
18
|
+
end
|
19
|
+
|
12
20
|
def self.included(mod)
|
13
21
|
mod.extend(MongoMapper::SoftDeleted::ClassMethods)
|
14
22
|
mod.send(:include, MongoMapper::SoftDeleted::InstanceMethods)
|
15
23
|
|
16
24
|
mod.after_destroy do
|
17
|
-
soft_delete_destroy(self)
|
25
|
+
soft_delete_destroy(self) if MongoMapper::SoftDeleted.enabled?
|
18
26
|
end
|
19
27
|
end
|
20
28
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mm_soft_deleted
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Taylor
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Soft delete records with mongo mapper
|
14
14
|
email: scott@railsnewbie.com
|