1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Ensure variables are not nil in case enlist_fixture_connections is

called

enlist_fixture_connections is currently called within the code when the
context is `run_in_transasction?`. However if
`enlist_fixture_connections` is called outside of that context the code
fails since these variables are not defined. This ensures the code can
still be executed without side effects
This commit is contained in:
Leo Correa 2021-04-22 13:45:15 -04:00
parent e56a5146cf
commit e088454bca
No known key found for this signature in database
GPG key ID: 73232F06E7D320B7

View file

@ -111,12 +111,11 @@ module ActiveRecord
@fixture_connections = []
@@already_loaded_fixtures ||= {}
@connection_subscriber = nil
# Load fixtures once and begin transaction.
if run_in_transaction?
@legacy_saved_pool_configs = Hash.new { |hash, key| hash[key] = {} }
@saved_pool_configs = Hash.new { |hash, key| hash[key] = {} }
# Load fixtures once and begin transaction.
if run_in_transaction?
if @@already_loaded_fixtures[self.class]
@loaded_fixtures = @@already_loaded_fixtures[self.class]
else