Permalink
Browse files

rollback transaction records to deal with after_hook problems #99

  • Loading branch information...
bmabey committed Jan 9, 2013
1 parent 737d2dc commit d6584cc394b343e02a734f8fb5075b8ed8afdb12
Showing with 5 additions and 0 deletions.
  1. +5 −0 lib/database_cleaner/active_record/transaction.rb
@@ -21,6 +21,11 @@ def clean
connection_class.connection.rollback_db_transaction
+ # The below is for handling after_commit hooks.. see https://github.com/bmabey/database_cleaner/issues/99
+ if connection_class.connection.respond_to?(:rollback_transaction_records)
+ connection_class.connection.send(:rollback_transaction_records, true)
+ end
+
if connection_class.connection.respond_to?(:decrement_open_transactions)
connection_class.connection.decrement_open_transactions
else

0 comments on commit d6584cc

Please sign in to comment.