-
-
Notifications
You must be signed in to change notification settings - Fork 270
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
Rails/BelongsTo does not work with scoped associations #435
Labels
bug
Something isn't working
Comments
koic
added a commit
to koic/rubocop-rails
that referenced
this issue
Feb 9, 2021
Fixes rubocop#435. This PR fixes a false negative for `Rails/BelongsTo` when using `belongs_to` lambda block with `required: false`.
koic
added a commit
to koic/rubocop-rails
that referenced
this issue
Feb 9, 2021
Fixes rubocop#435. This PR fixes a false negative for `Rails/BelongsTo` when using `belongs_to` lambda block with `required: false`.
9 tasks
koic
added a commit
to koic/rubocop-rails
that referenced
this issue
Feb 9, 2021
Fixes rubocop#435. This PR fixes a false negative for `Rails/BelongsTo` when using `belongs_to` lambda block with `required: false`.
koic
added a commit
to koic/rubocop-rails
that referenced
this issue
Feb 9, 2021
Fixes rubocop#435. This PR fixes a false negative for `Rails/BelongsTo` when using `belongs_to` lambda block with `required` option.
koic
added a commit
to koic/rubocop-rails
that referenced
this issue
Feb 9, 2021
Fixes rubocop#435. This PR fixes a false negative for `Rails/BelongsTo` when using `belongs_to` lambda block with `required` option.
koic
added a commit
to koic/rubocop-rails
that referenced
this issue
Feb 15, 2021
Fixes rubocop#435. This PR fixes a false negative for `Rails/BelongsTo` when using `belongs_to` lambda block with `required` option.
koic
added a commit
that referenced
this issue
Feb 15, 2021
…s_to [Fix #435] Fix a false negative for `Rails/BelongsTo`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The cop
Rails/BelongsTo
does not warn about usingrequired
keyword inbelongs_to :event, -> { with_deleted }, inverse_of: :task_work_templates, required: true
However, it works as expected when the scope is removed
belongs_to :event, inverse_of: :task_work_templates, required: true
Expected behavior
The cop warns about using the
required
keyword inbelongs_to
no matter a scope is specified or not.Actual behavior
The cop does not warn about using the
required
keyword inbelongs_to
when a scope is specified.Steps to reproduce the problem
Add a scope, e.g.
-> {}
to any existingbelongs_to
that usesrequired
.RuboCop version
The text was updated successfully, but these errors were encountered: