With Rails 7.0, you do not need to specify an inverse_of for relations with scopes as they can be automatically inferred. An option was added to rubocop to ignore scopes for this reason. Since the Rails 6 line is "soon" to be EOL and automatic_scope_inversing is the default for 7+, I believe IgnoreScopes: true should be added to the config of the Rails/InverseOf rule. My codebase had 3 relations flagged for Rails/InverseOf, but all 3 had scopes and did not need an inverse_of option. Thoughts?
With Rails 7.0, you do not need to specify an
inverse_of
for relations with scopes as they can be automatically inferred. An option was added to rubocop to ignore scopes for this reason. Since the Rails 6 line is "soon" to be EOL andautomatic_scope_inversing
is the default for 7+, I believeIgnoreScopes: true
should be added to the config of theRails/InverseOf
rule. My codebase had 3 relations flagged forRails/InverseOf
, but all 3 had scopes and did not need aninverse_of
option. Thoughts?