standardrb / standard-rails

A Standard Ruby plugin that configures rubocop-rails
MIT License
162 stars 15 forks source link

Use option IgnoreScopes: true for Rails/InverseOf #51

Closed Cohen-Carlisle closed 1 month ago

Cohen-Carlisle commented 1 month ago

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?

searls commented 1 month ago

I'd support a PR

Cohen-Carlisle commented 1 month ago

superseded by #54