mongoid_paranoia 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mongoid/paranoia.rb +4 -4
- data/lib/mongoid/paranoia/version.rb +1 -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: 2edfadf14fc3b166efd190f331c5e86a75de4c20
|
4
|
+
data.tar.gz: 988223f244d3537c149c7d354163031fbb658c5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37fb1381901fc197f18f79cbbfea5f8db627c94f8d9fa84da71a234878a69c4c9d6eec6e1ac6486f9fac4c59343556fc66ef186f0da5e92700396929b28534b7
|
7
|
+
data.tar.gz: f69bd91ff7eeabf02d205608a4081967ec02f703b4b807489b251898d44786739023263f44a6c55e07e638d01abe0aafb9386b98da5af67cd44581065662671e
|
data/lib/mongoid/paranoia.rb
CHANGED
@@ -98,7 +98,7 @@ module Mongoid
|
|
98
98
|
def remove_with_paranoia(options = {})
|
99
99
|
cascade!
|
100
100
|
time = self.deleted_at = Time.now
|
101
|
-
|
101
|
+
_paranoia_update("$set" => { paranoid_field => time })
|
102
102
|
@destroyed = true
|
103
103
|
true
|
104
104
|
end
|
@@ -145,7 +145,7 @@ module Mongoid
|
|
145
145
|
# @since 1.0.0
|
146
146
|
def restore(opts = {})
|
147
147
|
run_callbacks(:restore) do
|
148
|
-
|
148
|
+
_paranoia_update("$unset" => { paranoid_field => true })
|
149
149
|
attributes.delete("deleted_at")
|
150
150
|
@destroyed = false
|
151
151
|
restore_relations if opts[:recursive]
|
@@ -193,10 +193,10 @@ module Mongoid
|
|
193
193
|
embedded? ? "#{atomic_position}.#{field}" : field
|
194
194
|
end
|
195
195
|
|
196
|
-
# Update value in the collection.
|
196
|
+
# Update value in the collection (compatibility layer for Mongoid 4/5).
|
197
197
|
#
|
198
198
|
# @return [ Object ] Update result.
|
199
|
-
def
|
199
|
+
def _paranoia_update(value)
|
200
200
|
query = paranoid_collection.find(atomic_selector)
|
201
201
|
if Mongoid::Compatibility::Version.mongoid5?
|
202
202
|
query.update_one(value)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid_paranoia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Durran Jordan
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-09-
|
12
|
+
date: 2015-09-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mongoid
|