File tree Expand file tree Collapse file tree 3 files changed +5
-15
lines changed
activerecord/lib/active_record
railties/lib/rails/application Expand file tree Collapse file tree 3 files changed +5
-15
lines changed Original file line number Diff line number Diff line change @@ -760,21 +760,9 @@ def automatic_inverse_of
760
760
761
761
begin
762
762
reflection = klass . _reflect_on_association ( inverse_name )
763
- if !reflection
763
+ if !reflection && active_record . automatically_invert_plural_associations
764
764
plural_inverse_name = ActiveSupport ::Inflector . pluralize ( inverse_name )
765
765
reflection = klass . _reflect_on_association ( plural_inverse_name )
766
-
767
- if valid_inverse_reflection? ( reflection ) && !active_record . automatically_invert_plural_associations
768
- ActiveRecord . deprecator . warn (
769
- "The `#{ active_record . name } ##{ name } ` inverse association could have been automatically" \
770
- " inferred as `#{ klass . name } ##{ plural_inverse_name } ` but wasn't because `automatically_invert_plural_associations`" \
771
- " is disabled.\n \n " \
772
- "If automatic inference is intended, you can consider enabling" \
773
- " `config.active_record.automatically_invert_plural_associations`.\n \n " \
774
- "If automatic inference is not intended, you can silence this warning by defining the association with `inverse_of: nil`."
775
- )
776
- reflection = nil
777
- end
778
766
end
779
767
rescue NameError => error
780
768
raise unless error . name . to_s == class_name
Original file line number Diff line number Diff line change @@ -61,7 +61,6 @@ Below are the default values associated with each target version. In cases of co
61
61
#### Default Values for Target Version 7.2
62
62
63
63
- [ ` config.active_job.enqueue_after_transaction_commit ` ] ( #config-active-job-enqueue-after-transaction-commit ) : ` :default `
64
- - [ ` config.active_record.automatically_invert_plural_associations ` ] ( #config-active-record-automatically-invert-plural-associations ) : ` true `
65
64
- [ ` config.active_record.postgresql_adapter_decode_dates ` ] ( #config-active-record-postgresql-adapter-decode-dates ) : ` true `
66
65
- [ ` config.active_record.validate_migration_timestamps ` ] ( #config-active-record-validate-migration-timestamps ) : ` true `
67
66
- [ ` config.active_storage.web_image_content_types ` ] ( #config-active-storage-web-image-content-types ) : ` %w[image/png image/jpeg image/gif image/webp] `
@@ -1106,6 +1105,10 @@ class Comment < ApplicationRecord
1106
1105
end
1107
1106
```
1108
1107
1108
+ | Starting with version | The default value is |
1109
+ | --------------------- | -------------------- |
1110
+ | (original) | `false` |
1111
+
1109
1112
#### `config.active_record.validate_migration_timestamps`
1110
1113
1111
1114
Controls whether to validate migration timestamps. When set, an error will be raised if the
Original file line number Diff line number Diff line change @@ -332,7 +332,6 @@ def load_defaults(target_version)
332
332
if respond_to? ( :active_record )
333
333
active_record . postgresql_adapter_decode_dates = true
334
334
active_record . validate_migration_timestamps = true
335
- active_record . automatically_invert_plural_associations = true
336
335
end
337
336
when "8.0"
338
337
load_defaults "7.2"
You can’t perform that action at this time.
0 commit comments