File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed
lib/rails/generators/rails/app/templates/config/initializers Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change 46
46
# Rails.application.config.active_record.sqlite3_adapter_strict_strings_by_default = true
47
47
48
48
# Disable deprecated singular associations names
49
- # Rails.application.config.active_record.allow_deprecated_singular_associations_name = true
49
+ # Rails.application.config.active_record.allow_deprecated_singular_associations_name = false
Original file line number Diff line number Diff line change @@ -2383,6 +2383,32 @@ def index
2383
2383
assert_equal true , ActiveRecord . verify_foreign_keys_for_fixtures
2384
2384
end
2385
2385
2386
+ test "ActiveRecord.allow_deprecated_singular_associations_name is false by default for new apps" do
2387
+ app "development"
2388
+
2389
+ assert_equal false , ActiveRecord . allow_deprecated_singular_associations_name
2390
+ end
2391
+
2392
+ test "ActiveRecord.allow_deprecated_singular_associations_name is true by default for upgraded apps" do
2393
+ remove_from_config '.*config\.load_defaults.*\n'
2394
+
2395
+ app "development"
2396
+
2397
+ assert_equal true , ActiveRecord . allow_deprecated_singular_associations_name
2398
+ end
2399
+
2400
+ test "ActiveRecord.allow_deprecated_singular_associations_name can be configured via config.active_record.allow_deprecated_singular_associations_name" do
2401
+ remove_from_config '.*config\.load_defaults.*\n'
2402
+
2403
+ app_file "config/initializers/new_framework_defaults_7_1.rb" , <<-RUBY
2404
+ Rails.application.config.active_record.allow_deprecated_singular_associations_name = false
2405
+ RUBY
2406
+
2407
+ app "development"
2408
+
2409
+ assert_equal false , ActiveRecord . allow_deprecated_singular_associations_name
2410
+ end
2411
+
2386
2412
test "ActiveRecord::Base.run_commit_callbacks_on_first_saved_instances_in_transaction is false by default for new apps" do
2387
2413
app "development"
2388
2414
You can’t perform that action at this time.
0 commit comments