aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/transaction.rb7
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract_adapter.rb4
2 files changed, 7 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb b/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb
index 7618d6902d..54f873a2a2 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb
@@ -69,6 +69,10 @@ module ActiveRecord
def state
@state
end
+
+ def savepoint_name
+ nil
+ end
end
class TransactionState
@@ -233,7 +237,8 @@ module ActiveRecord
super
- @savepoint_name = "active_record_#{number}"
+ # Savepoint name only counts the Savepoint transactions, so we need to subtract 1
+ @savepoint_name = "active_record_#{number - 1}"
connection.create_savepoint(@savepoint_name)
end
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
index c31726437f..99c728814a 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
@@ -358,9 +358,7 @@ module ActiveRecord
end
def current_savepoint_name
- if current_transaction.is_a? SavepointTransaction
- current_transaction.savepoint_name
- end
+ current_transaction.savepoint_name
end
# Check the connection back in to the connection pool