mm-paranoid 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +6 -9
- data/lib/mm-paranoid.rb +7 -10
- metadata +10 -8
data/Rakefile
CHANGED
@@ -2,15 +2,12 @@ require "rubygems"
|
|
2
2
|
require "rake/gempackagetask"
|
3
3
|
require "rake/rdoctask"
|
4
4
|
|
5
|
-
require
|
6
|
-
|
7
|
-
|
8
|
-
t.spec_opts = %w(--format specdoc --colour)
|
9
|
-
t.libs = ["spec"]
|
10
|
-
end
|
5
|
+
require 'rspec/core/rake_task'
|
6
|
+
|
7
|
+
RSpec::Core::RakeTask.new(:spec)
|
11
8
|
|
9
|
+
task :default => :spec
|
12
10
|
|
13
|
-
task :default => ["spec"]
|
14
11
|
|
15
12
|
# This builds the actual gem. For details of what all these options
|
16
13
|
# mean, and other ones you can add, check the documentation here:
|
@@ -21,7 +18,7 @@ spec = Gem::Specification.new do |s|
|
|
21
18
|
|
22
19
|
# Change these as appropriate
|
23
20
|
s.name = "mm-paranoid"
|
24
|
-
s.version = "0.
|
21
|
+
s.version = "0.2.0"
|
25
22
|
s.summary = "Tiny plugin for MongoMapper to set deleted_at instead of actually deleting the record."
|
26
23
|
s.author = "Richard Livsey"
|
27
24
|
s.email = "richard@livsey.org"
|
@@ -37,7 +34,7 @@ spec = Gem::Specification.new do |s|
|
|
37
34
|
|
38
35
|
# If you want to depend on other gems, add them here, along with any
|
39
36
|
# relevant versions
|
40
|
-
s.add_dependency("mongo_mapper")
|
37
|
+
s.add_dependency("mongo_mapper", ">= 0.9.0")
|
41
38
|
|
42
39
|
# If your tests use any gems, include them here
|
43
40
|
s.add_development_dependency("rspec")
|
data/lib/mm-paranoid.rb
CHANGED
@@ -3,21 +3,18 @@ require 'mongo_mapper'
|
|
3
3
|
module MongoMapper
|
4
4
|
module Plugins
|
5
5
|
module Paranoid
|
6
|
-
|
7
|
-
model.plugin self
|
8
|
-
end
|
6
|
+
extend ActiveSupport::Concern
|
9
7
|
|
10
|
-
|
11
|
-
|
8
|
+
included do
|
9
|
+
key :deleted_at, Time, :index => true
|
12
10
|
end
|
13
11
|
|
14
12
|
module InstanceMethods
|
15
13
|
def destroy
|
16
|
-
run_callbacks(:
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
result
|
14
|
+
run_callbacks(:destroy) do
|
15
|
+
self.deleted_at = Time.now
|
16
|
+
self.save
|
17
|
+
end
|
21
18
|
end
|
22
19
|
|
23
20
|
def deleted?
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mm-paranoid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 23
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 2
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Richard Livsey
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-03-09 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -26,10 +26,12 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
29
|
+
hash: 59
|
30
30
|
segments:
|
31
31
|
- 0
|
32
|
-
|
32
|
+
- 9
|
33
|
+
- 0
|
34
|
+
version: 0.9.0
|
33
35
|
type: :runtime
|
34
36
|
version_requirements: *id001
|
35
37
|
- !ruby/object:Gem::Dependency
|
@@ -90,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
92
|
requirements: []
|
91
93
|
|
92
94
|
rubyforge_project:
|
93
|
-
rubygems_version: 1.
|
95
|
+
rubygems_version: 1.4.1
|
94
96
|
signing_key:
|
95
97
|
specification_version: 3
|
96
98
|
summary: Tiny plugin for MongoMapper to set deleted_at instead of actually deleting the record.
|