paranoid2 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +10 -0
- data/lib/paranoid2.rb +2 -0
- data/lib/paranoid2/persistence.rb +14 -2
- data/lib/paranoid2/version.rb +1 -1
- data/paranoid2.gemspec +1 -1
- data/spec/paranoid2_spec.rb +1 -1
- data/spec/spec_models.rb +1 -1
- metadata +26 -40
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: cd8254456dffe6785004b42a14847214d5a4817c
|
4
|
+
data.tar.gz: 8637b827888a0be9ec7712024e655f5719fcef3d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 352fb19eb6cca276dfa8da79aa3e4fc2c436b08d088da7b4245d2ad9fa524f5eb7e22ecb33cd3de2c2034745844198da66fa29efc7c0d7a3d8131547a0c6883e
|
7
|
+
data.tar.gz: bb5d6bfd7a4c668399d26f471e7d868d7e37a21861caa3d9a2be197a37094709765d59203dce6451e3d5e75551d473959c2f5fec8de598bf871c4b4278fdba58
|
data/README.md
CHANGED
data/lib/paranoid2.rb
CHANGED
@@ -12,7 +12,7 @@ module Paranoid2
|
|
12
12
|
|
13
13
|
def delete(opts = {})
|
14
14
|
with_paranoid(opts) do
|
15
|
-
|
15
|
+
touch(:deleted_at) if !deleted? && persisted?
|
16
16
|
if paranoid_force
|
17
17
|
self.class.unscoped { super() }
|
18
18
|
else
|
@@ -24,7 +24,19 @@ module Paranoid2
|
|
24
24
|
def restore(opts={})
|
25
25
|
return if !destroyed?
|
26
26
|
|
27
|
-
|
27
|
+
attrs = timestamp_attributes_for_update_in_model
|
28
|
+
current_time = current_time_from_proper_timezone
|
29
|
+
changes = {}
|
30
|
+
attrs.each do |column|
|
31
|
+
changes[column.to_s] = write_attribute(column.to_s, current_time)
|
32
|
+
end
|
33
|
+
changes['deleted_at'] = write_attribute('deleted_at', nil)
|
34
|
+
|
35
|
+
changes[self.class.locking_column] = increment_lock if locking_enabled?
|
36
|
+
|
37
|
+
@changed_attributes.except!(*changes.keys)
|
38
|
+
primary_key = self.class.primary_key
|
39
|
+
self.class.unscoped.where({ primary_key => self[primary_key] }).update_all(changes)
|
28
40
|
|
29
41
|
if opts.fetch(:associations) { true }
|
30
42
|
restore_associations
|
data/lib/paranoid2/version.rb
CHANGED
data/paranoid2.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
19
|
gem.require_paths = ["lib"]
|
20
20
|
|
21
|
-
gem.add_dependency 'activerecord', '>=
|
21
|
+
gem.add_dependency 'activerecord', '>= 3.2.11'
|
22
22
|
|
23
23
|
gem.add_development_dependency "rake"
|
24
24
|
gem.add_development_dependency "sqlite3"
|
data/spec/paranoid2_spec.rb
CHANGED
data/spec/spec_models.rb
CHANGED
metadata
CHANGED
@@ -1,64 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paranoid2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
version: 1.1.0
|
4
|
+
version: 1.1.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- yury
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-01
|
11
|
+
date: 2013-04-01 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: activerecord
|
16
|
-
version_requirements: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: 4.0.0.beta
|
22
15
|
requirement: !ruby/object:Gem::Requirement
|
23
|
-
none: false
|
24
16
|
requirements:
|
25
|
-
- -
|
17
|
+
- - '>='
|
26
18
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
28
|
-
prerelease: false
|
19
|
+
version: 3.2.11
|
29
20
|
type: :runtime
|
30
|
-
|
31
|
-
name: rake
|
21
|
+
prerelease: false
|
32
22
|
version_requirements: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
23
|
requirements:
|
35
|
-
- -
|
24
|
+
- - '>='
|
36
25
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
26
|
+
version: 3.2.11
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
38
29
|
requirement: !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
30
|
requirements:
|
41
|
-
- -
|
31
|
+
- - '>='
|
42
32
|
- !ruby/object:Gem::Version
|
43
33
|
version: '0'
|
44
|
-
prerelease: false
|
45
34
|
type: :development
|
46
|
-
|
47
|
-
name: sqlite3
|
35
|
+
prerelease: false
|
48
36
|
version_requirements: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
37
|
requirements:
|
51
|
-
- -
|
38
|
+
- - '>='
|
52
39
|
- !ruby/object:Gem::Version
|
53
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: sqlite3
|
54
43
|
requirement: !ruby/object:Gem::Requirement
|
55
|
-
none: false
|
56
44
|
requirements:
|
57
|
-
- -
|
45
|
+
- - '>='
|
58
46
|
- !ruby/object:Gem::Version
|
59
47
|
version: '0'
|
60
|
-
prerelease: false
|
61
48
|
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
62
55
|
description: paranoid models for rails 4
|
63
56
|
email:
|
64
57
|
- yury.korolev@gmail.com
|
@@ -82,33 +75,26 @@ files:
|
|
82
75
|
homepage: https://github.com/anjlab/paranoid2
|
83
76
|
licenses:
|
84
77
|
- MIT
|
78
|
+
metadata: {}
|
85
79
|
post_install_message:
|
86
80
|
rdoc_options: []
|
87
81
|
require_paths:
|
88
82
|
- lib
|
89
83
|
required_ruby_version: !ruby/object:Gem::Requirement
|
90
|
-
none: false
|
91
84
|
requirements:
|
92
|
-
- -
|
85
|
+
- - '>='
|
93
86
|
- !ruby/object:Gem::Version
|
94
87
|
version: '0'
|
95
|
-
hash: 2406579501986756191
|
96
|
-
segments:
|
97
|
-
- 0
|
98
88
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
|
-
none: false
|
100
89
|
requirements:
|
101
|
-
- -
|
90
|
+
- - '>='
|
102
91
|
- !ruby/object:Gem::Version
|
103
92
|
version: '0'
|
104
|
-
hash: 2406579501986756191
|
105
|
-
segments:
|
106
|
-
- 0
|
107
93
|
requirements: []
|
108
94
|
rubyforge_project:
|
109
|
-
rubygems_version:
|
95
|
+
rubygems_version: 2.0.0
|
110
96
|
signing_key:
|
111
|
-
specification_version:
|
97
|
+
specification_version: 4
|
112
98
|
summary: paranoid models for rails 4
|
113
99
|
test_files:
|
114
100
|
- spec/paranoid2_spec.rb
|