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
b23c08fe
Commit
b23c08fe
authored
Oct 24, 2013
by
Ryan Bigg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add alias 'deleted' to rails4 branch
parent
172efa86
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
0 deletions
+2
-0
lib/paranoia.rb
+1
-0
test/paranoia_test.rb
+1
-0
No files found.
lib/paranoia.rb
View file @
b23c08fe
...
@@ -14,6 +14,7 @@ module Paranoia
...
@@ -14,6 +14,7 @@ module Paranoia
def
only_deleted
def
only_deleted
with_deleted
.
where
.
not
(
deleted_at:
nil
)
with_deleted
.
where
.
not
(
deleted_at:
nil
)
end
end
alias
:deleted
:only_deleted
def
restore
(
id
)
def
restore
(
id
)
if
id
.
is_a?
(
Array
)
if
id
.
is_a?
(
Array
)
...
...
test/paranoia_test.rb
View file @
b23c08fe
...
@@ -82,6 +82,7 @@ class ParanoiaTest < Test::Unit::TestCase
...
@@ -82,6 +82,7 @@ class ParanoiaTest < Test::Unit::TestCase
p2
.
destroy
p2
.
destroy
assert_equal
0
,
parent1
.
paranoid_models
.
count
assert_equal
0
,
parent1
.
paranoid_models
.
count
assert_equal
1
,
parent1
.
paranoid_models
.
only_deleted
.
count
assert_equal
1
,
parent1
.
paranoid_models
.
only_deleted
.
count
assert_equal
1
,
parent1
.
paranoid_models
.
deleted
.
count
p3
=
ParanoidModel
.
create
(
:parent_model
=>
parent1
)
p3
=
ParanoidModel
.
create
(
:parent_model
=>
parent1
)
assert_equal
2
,
parent1
.
paranoid_models
.
with_deleted
.
count
assert_equal
2
,
parent1
.
paranoid_models
.
with_deleted
.
count
assert_equal
[
p1
,
p3
],
parent1
.
paranoid_models
.
with_deleted
assert_equal
[
p1
,
p3
],
parent1
.
paranoid_models
.
with_deleted
...
...
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