Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
paranoia
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ikcrm_common
paranoia
Commits
c9227381
Commit
c9227381
authored
Apr 08, 2014
by
Ryan Bigg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use an unscoped call on associations within really_destroy to REALLY DESTROY ALL THE THINGS
💣
parent
4f268326
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletions
+9
-1
lib/paranoia.rb
+1
-1
test/paranoia_test.rb
+8
-0
No files found.
lib/paranoia.rb
View file @
c9227381
...
@@ -135,7 +135,7 @@ class ActiveRecord::Base
...
@@ -135,7 +135,7 @@ class ActiveRecord::Base
end
end
if
dependent_reflections
.
any?
if
dependent_reflections
.
any?
dependent_reflections
.
each
do
|
name
,
_
|
dependent_reflections
.
each
do
|
name
,
_
|
self
.
send
(
name
).
each
(
&
:really_destroy!
)
self
.
send
(
name
).
unscoped
.
each
(
&
:really_destroy!
)
end
end
end
end
destroy!
destroy!
...
...
test/paranoia_test.rb
View file @
c9227381
...
@@ -301,6 +301,14 @@ class ParanoiaTest < test_framework
...
@@ -301,6 +301,14 @@ class ParanoiaTest < test_framework
refute
RelatedModel
.
unscoped
.
exists?
(
child
.
id
)
refute
RelatedModel
.
unscoped
.
exists?
(
child
.
id
)
end
end
def
test_real_destroy_dependent_destroy_after_normal_destroy
parent
=
ParentModel
.
create
child
=
parent
.
very_related_models
.
create
parent
.
destroy
parent
.
really_destroy!
refute
RelatedModel
.
unscoped
.
exists?
(
child
.
id
)
end
if
ActiveRecord
::
VERSION
::
STRING
<
"4.1"
if
ActiveRecord
::
VERSION
::
STRING
<
"4.1"
def
test_real_destroy
def
test_real_destroy
model
=
ParanoidModel
.
new
model
=
ParanoidModel
.
new
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment