paranoia 2.4.0 → 2.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +8 -3
- data/CHANGELOG.md +6 -0
- data/Gemfile +1 -1
- data/README.md +6 -0
- data/lib/paranoia.rb +4 -0
- data/lib/paranoia/active_record_5_2.rb +41 -0
- data/lib/paranoia/version.rb +1 -1
- data/paranoia.gemspec +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d25bfc4e0254aba4db5a58da8d666c68052e836bc2f315efbcd5ec2b77657b30
|
4
|
+
data.tar.gz: d413ea576910faa0e4ebaff07c617c8692db837beeb24a5d5d43d0794170981f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 354429a32eb5c97b1662456e56a5df64ff8b2c0d4ae02e57d528384eb33c17a161f5972275babfd55c279f7de54552073ae425c9a2c4b676a383ca55c83a8cfe
|
7
|
+
data.tar.gz: 3f5e1914d1f200e82c8e1775bf2859e253b7aa6b434eaaf841276db9f017185f0f985ff7ef80ed53d103b1f21762419315568aa097a662946aab85db28431369
|
data/.travis.yml
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
sudo: false
|
2
2
|
language: ruby
|
3
|
+
before_install: gem update --system
|
3
4
|
cache: bundler
|
4
5
|
rvm:
|
5
|
-
- 2.2
|
6
|
-
- 2.3.
|
7
|
-
- 2.4.
|
6
|
+
- 2.2
|
7
|
+
- 2.3.5
|
8
|
+
- 2.4.3
|
9
|
+
- 2.5.0
|
8
10
|
- jruby-9.1.6.0
|
9
11
|
|
10
12
|
env:
|
@@ -12,6 +14,7 @@ env:
|
|
12
14
|
- RAILS='~> 4.2.0'
|
13
15
|
- RAILS='~> 5.0.0'
|
14
16
|
- RAILS='~> 5.1.0'
|
17
|
+
- RAILS='~> 5.2.0'
|
15
18
|
|
16
19
|
matrix:
|
17
20
|
allow_failures:
|
@@ -21,3 +24,5 @@ matrix:
|
|
21
24
|
rvm: jruby-9.1.6.0
|
22
25
|
- env: RAILS='~> 5.1.0'
|
23
26
|
rvm: jruby-9.1.6.0
|
27
|
+
- env: RAILS='~> 5.2.0'
|
28
|
+
rvm: jruby-9.1.6.0
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# paranoia Changelog
|
2
2
|
|
3
|
+
## 2.4.1
|
4
|
+
|
5
|
+
* [#435](https://github.com/rubysherpas/paranoia/pull/435) Monkeypatch activerecord relations to work with rails 6.2.0
|
6
|
+
|
7
|
+
[Bartosz Bonisławski (@bbonislawski)](https://github.com/bbonislawski)
|
8
|
+
|
3
9
|
## 2.4.0
|
4
10
|
|
5
11
|
* [#423](https://github.com/rubysherpas/paranoia/pull/423) Add `paranoia_destroy` and `paranoia_delete` aliases
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
**Notice:**
|
2
|
+
|
3
|
+
`paranoia` has some surprising behaviour (like overriding ActiveRecord's `delete` and `destroy`) and is not recommended for new projects. See [`discard`'s README](https://github.com/jhawthorn/discard#why-not-paranoia-or-acts_as_paranoid) for more details.
|
4
|
+
|
5
|
+
Paranoia will continue to accept bug fixes and support new versions of Rails but isn't accepting new features.
|
6
|
+
|
1
7
|
# Paranoia
|
2
8
|
|
3
9
|
Paranoia is a re-implementation of [acts\_as\_paranoid](http://github.com/ActsAsParanoid/acts_as_paranoid) for Rails 3/4/5, using much, much, much less code.
|
data/lib/paranoia.rb
CHANGED
@@ -0,0 +1,41 @@
|
|
1
|
+
module HandleParanoiaDestroyedInBelongsToAssociation
|
2
|
+
def handle_dependency
|
3
|
+
return unless load_target
|
4
|
+
|
5
|
+
case options[:dependent]
|
6
|
+
when :destroy
|
7
|
+
target.destroy
|
8
|
+
if target.respond_to?(:paranoia_destroyed?)
|
9
|
+
raise ActiveRecord::Rollback unless target.paranoia_destroyed?
|
10
|
+
else
|
11
|
+
raise ActiveRecord::Rollback unless target.destroyed?
|
12
|
+
end
|
13
|
+
else
|
14
|
+
target.send(options[:dependent])
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
module HandleParanoiaDestroyedInHasOneAssociation
|
20
|
+
def delete(method = options[:dependent])
|
21
|
+
if load_target
|
22
|
+
case method
|
23
|
+
when :delete
|
24
|
+
target.delete
|
25
|
+
when :destroy
|
26
|
+
target.destroyed_by_association = reflection
|
27
|
+
target.destroy
|
28
|
+
if target.respond_to?(:paranoia_destroyed?)
|
29
|
+
throw(:abort) unless target.paranoia_destroyed?
|
30
|
+
else
|
31
|
+
throw(:abort) unless target.destroyed?
|
32
|
+
end
|
33
|
+
when :nullify
|
34
|
+
target.update_columns(reflection.foreign_key => nil) if target.persisted?
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
ActiveRecord::Associations::BelongsToAssociation.prepend HandleParanoiaDestroyedInBelongsToAssociation
|
41
|
+
ActiveRecord::Associations::HasOneAssociation.prepend HandleParanoiaDestroyedInHasOneAssociation
|
data/lib/paranoia/version.rb
CHANGED
data/paranoia.gemspec
CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
|
|
24
24
|
|
25
25
|
s.required_ruby_version = '>= 2.0'
|
26
26
|
|
27
|
-
s.add_dependency 'activerecord', '>= 4.0', '< 5.
|
27
|
+
s.add_dependency 'activerecord', '>= 4.0', '< 5.3'
|
28
28
|
|
29
29
|
s.add_development_dependency "bundler", ">= 1.0.0"
|
30
30
|
s.add_development_dependency "rake"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paranoia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- radarlistener@gmail.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '4.0'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '5.
|
22
|
+
version: '5.3'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '4.0'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '5.
|
32
|
+
version: '5.3'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: bundler
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -83,6 +83,7 @@ files:
|
|
83
83
|
- README.md
|
84
84
|
- Rakefile
|
85
85
|
- lib/paranoia.rb
|
86
|
+
- lib/paranoia/active_record_5_2.rb
|
86
87
|
- lib/paranoia/rspec.rb
|
87
88
|
- lib/paranoia/version.rb
|
88
89
|
- paranoia.gemspec
|
@@ -107,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
108
|
version: 1.3.6
|
108
109
|
requirements: []
|
109
110
|
rubyforge_project:
|
110
|
-
rubygems_version: 2.6
|
111
|
+
rubygems_version: 2.7.6
|
111
112
|
signing_key:
|
112
113
|
specification_version: 4
|
113
114
|
summary: Paranoia is a re-implementation of acts_as_paranoid for Rails 3, 4, and 5,
|