Skip to content

Commit 36c8d45

Browse files
authored
Merge pull request #2436 from yahonda/backport_2433_to_release71
Merge pull request #2433 from wojtha/fix-rails-71-reconnect
2 parents 8fd4592 + b6544c3 commit 36c8d45

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/active_record/connection_adapters/oracle_enhanced_adapter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ def reconnect
467467
end
468468

469469
# Reconnects to the database.
470-
def reconnect! # :nodoc:
470+
def reconnect!(restore_transactions: false) # :nodoc:
471471
super
472472
_connection.reset!
473473
rescue OracleEnhanced::ConnectionException => e

spec/active_record/connection_adapters/oracle_enhanced/connection_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@
3030
expect(ActiveRecord::Base.connection).to be_active
3131
end
3232

33+
it "should be active after reconnection to database with restore_transactions: true" do
34+
ActiveRecord::Base.establish_connection(CONNECTION_PARAMS)
35+
ActiveRecord::Base.connection.reconnect!(restore_transactions: true)
36+
expect(ActiveRecord::Base.connection).to be_active
37+
end
38+
3339
it "should use database default cursor_sharing parameter value force by default" do
3440
# Use `SYSTEM_CONNECTION_PARAMS` to query v$parameter
3541
ActiveRecord::Base.establish_connection(SYSTEM_CONNECTION_PARAMS)

0 commit comments

Comments
 (0)