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
2ec3031c
Commit
2ec3031c
authored
Feb 08, 2016
by
Kurtis Rainbolt-Greene
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #291 from rainforestapp/fix_null_transaction
Don't try to add to null transactions
parents
9e0ec38e
f04b13ac
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletions
+9
-1
lib/paranoia.rb
+1
-1
test/paranoia_test.rb
+8
-0
No files found.
lib/paranoia.rb
View file @
2ec3031c
...
@@ -93,7 +93,7 @@ module Paranoia
...
@@ -93,7 +93,7 @@ module Paranoia
if
persisted?
if
persisted?
# if a transaction exists, add the record so that after_commit
# if a transaction exists, add the record so that after_commit
# callbacks can be run
# callbacks can be run
add_to_transaction
add_to_transaction
unless
self
.
class
.
connection
.
current_transaction
.
closed?
update_columns
(
paranoia_destroy_attributes
)
update_columns
(
paranoia_destroy_attributes
)
elsif
!
frozen?
elsif
!
frozen?
assign_attributes
(
paranoia_destroy_attributes
)
assign_attributes
(
paranoia_destroy_attributes
)
...
...
test/paranoia_test.rb
View file @
2ec3031c
...
@@ -96,6 +96,14 @@ class ParanoiaTest < test_framework
...
@@ -96,6 +96,14 @@ class ParanoiaTest < test_framework
assert_equal
to_param
,
model
.
to_param
assert_equal
to_param
,
model
.
to_param
end
end
def
test_paranoid_model_delete_outside_transaction
model
=
ParanoidModel
.
new
model
.
save!
model
.
delete
assert
model
.
to_param
end
def
test_destroy_behavior_for_plain_models
def
test_destroy_behavior_for_plain_models
model
=
PlainModel
.
new
model
=
PlainModel
.
new
assert_equal
0
,
model
.
class
.
count
assert_equal
0
,
model
.
class
.
count
...
...
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