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
b1a4a6f2
Commit
b1a4a6f2
authored
Sep 04, 2014
by
Alexey Pokhozhaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clear association cache after restore with recursive
parent
fe706284
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
lib/paranoia.rb
+2
-0
test/paranoia_test.rb
+15
-0
No files found.
lib/paranoia.rb
View file @
b1a4a6f2
...
...
@@ -143,6 +143,8 @@ module Paranoia
end
end
end
clear_association_cache
if
destroyed_associations
.
present?
end
end
...
...
test/paranoia_test.rb
View file @
b1a4a6f2
...
...
@@ -537,6 +537,21 @@ class ParanoiaTest < test_framework
connect!
# Reconnect the main connection
end
def
test_restore_clear_association_cache_if_associations_present
parent
=
ParentModel
.
create
3
.
times
{
parent
.
very_related_models
.
create
}
parent
.
destroy
assert_equal
0
,
parent
.
very_related_models
.
count
assert_equal
0
,
parent
.
very_related_models
.
size
parent
.
restore
(
recursive:
true
)
assert_equal
3
,
parent
.
very_related_models
.
count
assert_equal
3
,
parent
.
very_related_models
.
size
end
private
def
get_featureful_model
FeaturefulModel
.
new
(
:name
=>
"not empty"
)
...
...
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