mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-28 01:53:25 +00:00
Patch Paranoia#delete to resolve ActiveRecord::ConnectionAdapters::NullTransaction errors
Patches Paranoia gem to fix a conflict with transactions in Rspec: https://github.com/rubysherpas/paranoia/issues/274 Example error: ``` Failure/Error: order.line_items.first.variant.tap(&:delete) NoMethodError: undefined method `state' for #<ActiveRecord::ConnectionAdapters::NullTransaction:0x0000564117dddd18> ```
This commit is contained in:
@@ -4,7 +4,7 @@ module Paranoia
|
||||
if persisted?
|
||||
# if a transaction exists, add the record so that after_commit
|
||||
# callbacks can be run
|
||||
add_to_transaction
|
||||
add_to_transaction unless self.class.connection.current_transaction.closed?
|
||||
update_columns(paranoia_destroy_attributes)
|
||||
elsif !frozen?
|
||||
assign_attributes(paranoia_destroy_attributes)
|
||||
|
||||
Reference in New Issue
Block a user