diff options
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract/transaction.rb')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/transaction.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb b/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb index 11440e30d4..3a1e4a4a88 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb @@ -77,6 +77,10 @@ module ActiveRecord @state.set_state(:committed) end + def before_commit_records + records.uniq.each(&:before_committed!) + end + def commit_records ite = records.uniq while record = ite.shift @@ -159,13 +163,15 @@ module ActiveRecord def commit_transaction inner_transaction = @stack.pop - inner_transaction.commit if current_transaction.joinable? + inner_transaction.commit inner_transaction.records.each do |r| r.add_to_transaction end else + inner_transaction.before_commit_records + inner_transaction.commit inner_transaction.commit_records end end |