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
d0d6a021
Commit
d0d6a021
authored
Jun 13, 2011
by
Eli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Real deletion
parent
e76e94e4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
1 deletions
+19
-1
lib/paranoia.rb
+3
-1
test/paranoia_test.rb
+16
-0
No files found.
lib/paranoia.rb
View file @
d0d6a021
...
...
@@ -34,7 +34,9 @@ end
class
ActiveRecord
::
Base
def
self
.
acts_as_paranoid
self
.
send
(
:include
,
Paranoia
)
alias_method
:destroy!
,
:destroy
alias_method
:delete!
,
:delete
include
Paranoia
default_scope
:conditions
=>
{
:deleted_at
=>
nil
}
end
...
...
test/paranoia_test.rb
View file @
d0d6a021
...
...
@@ -114,6 +114,22 @@ class ParanoiaTest < Test::Unit::TestCase
assert_equal
false
,
model
.
destroyed?
end
def
test_real_destroy
model
=
ParanoidModel
.
new
model
.
save
model
.
destroy!
assert_equal
false
,
ParanoidModel
.
unscoped
.
exists?
(
model
.
id
)
end
def
test_real_delete
model
=
ParanoidModel
.
new
model
.
save
model
.
delete!
assert_equal
false
,
ParanoidModel
.
unscoped
.
exists?
(
model
.
id
)
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