From d6ec8dbc4851a6e6dce9951744d55cf80144e6f5 Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Sat, 30 Mar 2024 09:53:38 +0100 Subject: [PATCH] Suggest `inverse_of: nil` instead of `false` Followup: https://github.com/rails/rails/pull/50883 Ref: https://github.com/rails/rails/pull/50284#issuecomment-2027722175 --- activerecord/lib/active_record/reflection.rb | 2 +- guides/source/configuring.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb index d3a2b0b3ac..5d1c8f1c38 100644 --- a/activerecord/lib/active_record/reflection.rb +++ b/activerecord/lib/active_record/reflection.rb @@ -715,7 +715,7 @@ def automatic_inverse_of " is disabled.\n\n" \ "If automatic inference is intended, you can consider enabling" \ " `config.active_record.automatically_invert_plural_associations`.\n\n" \ - "If automatic inference is not intended, you can silence this warning by defining the association with `inverse_of: false`." + "If automatic inference is not intended, you can silence this warning by defining the association with `inverse_of: nil`." ) reflection = nil end diff --git a/guides/source/configuring.md b/guides/source/configuring.md index 5eb4dba9ed..da97488e24 100644 --- a/guides/source/configuring.md +++ b/guides/source/configuring.md @@ -1090,7 +1090,7 @@ And on a per-association basis: class Comment < ApplicationRecord self.automatically_invert_plural_associations = true - belongs_to :post, inverse_of: false + belongs_to :post, inverse_of: nil end ```