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
9b8158e2
Commit
9b8158e2
authored
Jan 21, 2015
by
John Hawthorn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Always return self from touch_paranoia_column
parent
b99fd225
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
8 deletions
+5
-8
lib/paranoia.rb
+5
-8
No files found.
lib/paranoia.rb
View file @
9b8158e2
...
@@ -57,12 +57,11 @@ module Paranoia
...
@@ -57,12 +57,11 @@ module Paranoia
end
end
def
destroy
def
destroy
callbacks_result
=
transaction
do
transaction
do
run_callbacks
(
:destroy
)
do
run_callbacks
(
:destroy
)
do
touch_paranoia_column
touch_paranoia_column
end
end
end
end
callbacks_result
?
self
:
false
end
end
# As of Rails 4.1.0 +destroy!+ will no longer remove the record from the db
# As of Rails 4.1.0 +destroy!+ will no longer remove the record from the db
...
@@ -76,8 +75,7 @@ module Paranoia
...
@@ -76,8 +75,7 @@ module Paranoia
end
end
def
delete
def
delete
return
if
new_record?
touch_paranoia_column
touch_paranoia_column
(
false
)
end
end
def
restore!
(
opts
=
{})
def
restore!
(
opts
=
{})
...
@@ -109,16 +107,15 @@ module Paranoia
...
@@ -109,16 +107,15 @@ module Paranoia
# insert time to paranoia column.
# insert time to paranoia column.
# @param with_transaction [Boolean] exec with ActiveRecord Transactions.
# @param with_transaction [Boolean] exec with ActiveRecord Transactions.
def
touch_paranoia_column
(
with_transaction
=
false
)
def
touch_paranoia_column
(
with_transaction
=
false
)
return
self
if
really_destroyed?
||
new_record?
# This method is (potentially) called from really_destroy
# This method is (potentially) called from really_destroy
# The object the method is being called on may be frozen
# The object the method is being called on may be frozen
# Let's not touch it if it's frozen.
# Let's not touch it if it's frozen.
unless
self
.
frozen?
unless
self
.
frozen?
if
with_transaction
with_transaction_returning_status
{
touch
(
paranoia_column
)
}
else
touch
(
paranoia_column
)
touch
(
paranoia_column
)
end
end
end
self
end
end
# restore associated records that have been soft deleted when
# restore associated records that have been soft deleted when
...
...
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