diff options
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/transaction.rb | 23 |
2 files changed, 7 insertions, 18 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb index 5eb0f0f132..4cbc6a5035 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb @@ -203,7 +203,7 @@ module ActiveRecord begin @transaction = @transaction.commit rescue Exception - @transaction = @transaction.parent + @transaction = @transaction.rollback raise end end diff --git a/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb b/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb index 4f1f9223ec..7f82b8f666 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb @@ -84,23 +84,12 @@ module ActiveRecord def commit @finishing = true - begin - if parent.open? - connection.release_savepoint - records.each { |r| parent.add_record(r) } - else - connection.commit_db_transaction - commit_records - end - rescue Exception - if parent.open? - connection.rollback_to_savepoint - else - connection.rollback_db_transaction - end - - rollback_records - raise + if parent.open? + connection.release_savepoint + records.each { |r| parent.add_record(r) } + else + connection.commit_db_transaction + commit_records end parent |