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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 640b65e619333082f0a8ee8269629970993c6494
4
- data.tar.gz: 7bfc8ac93f9a58f8f0c74a6b809ab8b1e39f0ac9
3
+ metadata.gz: 2cedeb19982d4aaf9e243a4827b2f441136b6872
4
+ data.tar.gz: 9f99c53a1dd1e5340dcea8f9877d5f5568356877
5
5
  SHA512:
6
- metadata.gz: bd598388a77484e128b7a0acd346abf921d0aec9e24bb9653ac9d790cd5d8bbd7b9bcfce2d64343135627bbb017eaf0dafb536623f47a50b0096dabd870efb7e
7
- data.tar.gz: 8abbbc902b475bb897b22d8445092c7eb02b0b82b7dee2ba87456c3d723f8727673d8aeb9695170779a00a186405a6f337e15c7e2113d2f8fc6ac225a0d5c193
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.1
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-09-21 00:00:00.000000000 Z
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