File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed
activerecord/lib/active_record
railties/test/application Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -241,8 +241,7 @@ class Railtie < Rails::Railtie # :nodoc:
241
241
end
242
242
243
243
ActiveSupport . on_load ( :active_record ) do
244
- # Configs used in other initializers
245
- configs = configs . except (
244
+ configs_used_in_other_initializers = configs . except (
246
245
:migration_error ,
247
246
:database_selector ,
248
247
:database_resolver ,
@@ -259,7 +258,7 @@ class Railtie < Rails::Railtie # :nodoc:
259
258
:postgresql_adapter_decode_dates ,
260
259
)
261
260
262
- configs . each do |k , v |
261
+ configs_used_in_other_initializers . each do |k , v |
263
262
next if k == :encryption
264
263
setter = "#{ k } ="
265
264
# Some existing initializers might rely on Active Record configuration
Original file line number Diff line number Diff line change @@ -4482,6 +4482,20 @@ def new(app); self; end
4482
4482
assert_equal true , ActiveRecord . run_after_transaction_callbacks_in_order_defined
4483
4483
end
4484
4484
4485
+ test "run_after_transaction_callbacks_in_order_defined can be set via framework defaults even if Active Record was previously loaded" do
4486
+ remove_from_config '.*config\.load_defaults.*\n'
4487
+ add_to_config 'config.load_defaults "7.0"'
4488
+ app_file "config/initializers/01_configure_database.rb" , <<-RUBY
4489
+ ActiveRecord::Base.connected?
4490
+ RUBY
4491
+ app_file "config/initializers/new_framework_defaults_7_1.rb" , <<-RUBY
4492
+ Rails.application.config.active_record.run_after_transaction_callbacks_in_order_defined = true
4493
+ RUBY
4494
+ app "development"
4495
+
4496
+ assert_equal true , ActiveRecord . run_after_transaction_callbacks_in_order_defined
4497
+ end
4498
+
4485
4499
test "raises if configuration tries to assign to an actual method" do
4486
4500
remove_from_config '.*config\.load_defaults.*\n'
4487
4501
add_to_config 'config.load_defaults = "7.0"'
You can’t perform that action at this time.
0 commit comments