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:
parent
e56a5146cf
commit
e088454bca
1 changed files with 2 additions and 3 deletions
|
@ -111,12 +111,11 @@ module ActiveRecord
|
||||||
@fixture_connections = []
|
@fixture_connections = []
|
||||||
@@already_loaded_fixtures ||= {}
|
@@already_loaded_fixtures ||= {}
|
||||||
@connection_subscriber = nil
|
@connection_subscriber = nil
|
||||||
|
|
||||||
# Load fixtures once and begin transaction.
|
|
||||||
if run_in_transaction?
|
|
||||||
@legacy_saved_pool_configs = Hash.new { |hash, key| hash[key] = {} }
|
@legacy_saved_pool_configs = Hash.new { |hash, key| hash[key] = {} }
|
||||||
@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]
|
if @@already_loaded_fixtures[self.class]
|
||||||
@loaded_fixtures = @@already_loaded_fixtures[self.class]
|
@loaded_fixtures = @@already_loaded_fixtures[self.class]
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue