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