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

Rails/HasManyOrHasOneDependent should accept dependent: nil #147

Closed
grosser opened this issue Nov 3, 2019 · 5 comments · Fixed by #467
Closed

Rails/HasManyOrHasOneDependent should accept dependent: nil #147

grosser opened this issue Nov 3, 2019 · 5 comments · Fixed by #467

Comments

@grosser
Copy link
Contributor

grosser commented Nov 3, 2019

We use dependent: nil to mean "I though about dependencies and nothing should be done"
it's also a valid option in rails ... so please don't alert on this.

app/models/user.rb:23:3: C: Rails/HasManyOrHasOneDependent: Specify a :dependent option.
  has_many :jobs, dependent: nil, inverse_of: :user
@andyw8
Copy link
Contributor

andyw8 commented Nov 3, 2019

@grosser
Copy link
Contributor Author

grosser commented Nov 3, 2019 via email

@andyw8
Copy link
Contributor

andyw8 commented Nov 4, 2019

Thanks. I think it's probably best to wait for a response from someone on the Rails team before this is added to rubocop-rails.

@grosser
Copy link
Contributor Author

grosser commented Dec 17, 2019

merged into rails now ... good to go here ?

@andyw8
Copy link
Contributor

andyw8 commented Dec 17, 2019

👍 PR welcome.

koic added a commit to koic/rubocop-rails that referenced this issue Apr 27, 2021
…ndent`

Fixes rubocop#147.
Closes rubocop#176.

This PR fixes a false positive for `Rails/HasManyOrHasOneDependent`
when specifying defalt `dependent: nil` strategy.
koic added a commit to koic/rubocop-rails that referenced this issue Apr 27, 2021
…ndent`

Fixes rubocop#147.
Closes rubocop#176.

This PR fixes a false positive for `Rails/HasManyOrHasOneDependent`
when specifying default `dependent: nil` strategy.
@koic koic closed this as completed in #467 Apr 27, 2021
koic added a commit that referenced this issue Apr 27, 2021
…ny_or_has_one_dependent

[Fix #147] Fix a false positive for `Rails/HasManyOrHasOneDependent`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants