Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix false positive for :class_name option in Rails/InverseOf cop #5726

Merged
merged 1 commit into from
Mar 31, 2018

Conversation

bdewater
Copy link
Contributor

@bdewater bdewater commented Mar 26, 2018

As reported in #5045 (comment) this was introduced in #5297 as a footnote /cc @swrobel @wata727

This option is not in ActiveRecord::Reflection::AssociationReflection::INVALID_AUTOMATIC_INVERSE_OPTIONS

The documentation explains what the class name option is used for:
https://github.com/rails/rails/blob/2baf1aaeb1e1385ad2bf20728f4bc8c24efc7245/activerecord/lib/active_record/associations.rb#L1002-L1017

  • Wrote good commit messages.
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Added an entry to the Changelog if the new code introduces user-observable changes. See changelog entry format.
  • The PR relates to only one subject with a clear title
    and description in grammatically correct, complete sentences.
  • Run rake default or rake parallel. It executes all tests and RuboCop for itself, and generates the documentation.

This option is not in `ActiveRecord::Reflection::AssociationReflection::INVALID_AUTOMATIC_INVERSE_OPTIONS`

The documentation explains what the class name option is used for:
https://github.com/rails/rails/blob/master/activerecord/lib/active_record/associations.rb#L1002-L1017
Copy link
Contributor

@wata727 wata727 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. This was introduced by my misunderstanding and confirmed that it works correctly with the class_name option. Thanks!

Copy link
Collaborator

@pocke pocke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@pocke pocke merged commit 8428ad4 into rubocop:master Mar 31, 2018
@bdewater bdewater deleted the fix-inverseof-classname branch March 31, 2018 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants