diff options
author | Arthur Neves <arthurnn@gmail.com> | 2014-08-08 15:46:00 -0400 |
---|---|---|
committer | Arthur Neves <arthurnn@gmail.com> | 2014-08-15 16:04:39 -0400 |
commit | 2e90fe736de73cfd89eed68b38e03eb6175314bc (patch) | |
tree | 8894bfbea8e8ec985eadacc794045869c21dea39 /activerecord/lib | |
parent | 0002954512364f2f69d28798f7a79aa8e27d7b6b (diff) | |
download | rails-2e90fe736de73cfd89eed68b38e03eb6175314bc.tar.gz rails-2e90fe736de73cfd89eed68b38e03eb6175314bc.tar.bz2 rails-2e90fe736de73cfd89eed68b38e03eb6175314bc.zip |
Fix regression on after_commit in nested transactions.
after_commit should not run in nested transactions, however they should
run once the outermost transaction gets committed. This patch fixes the
problem copying the records from the Savepoint to its parent. So the
RealTransaction will have all records that needs to run callbacks on it.
[fixes #16425]
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/transaction.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb b/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb index 3fce32211d..8f06cf3a1f 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb @@ -111,6 +111,8 @@ module ActiveRecord def commit super connection.release_savepoint(savepoint_name) + parent = connection.transaction_manager.current_transaction + records.each { |r| parent.add_record(r) } end def full_rollback?; false; end |