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

WhereRange doesn't suggest corrections for <= comparisons #1312

Closed
vrodic opened this issue Jul 11, 2024 · 3 comments
Closed

WhereRange doesn't suggest corrections for <= comparisons #1312

vrodic opened this issue Jul 11, 2024 · 3 comments

Comments

@vrodic
Copy link

vrodic commented Jul 11, 2024

With string where queries like where("starts_at <= :ends_at", ends_at: ends_at.end_of_day) the WhereRange cop doesn't suggest changing this to where(starts_at: ..ends_at.end_of_day)


RuboCop version

$ [bundle exec] rubocop -V
1.65.0 (using Parser 3.3.4.0, rubocop-ast 1.31.3, running on ruby 3.2.2) [x86_64-linux]
  - rubocop-minitest 0.35.1
  - rubocop-performance 1.21.1
  - rubocop-rails 2.25.1
@koic
Copy link
Member

koic commented Jul 14, 2024

I'd like to know more about the context. Are you referring to a case where join is used with where("starts_at <= :ends_at", ends_at: ends_at.end_of_day) to perform table joins?

@koic
Copy link
Member

koic commented Jul 14, 2024

I'm wondering if this point about Safety section is already mentioned in the documentation:
https://docs.rubocop.org/rubocop-rails/2.25/cops_rails.html#railswhererange

@koic
Copy link
Member

koic commented Oct 1, 2024

As there hasn't been any activity for a while, I will close this issue. Please feel free to reopen it with further details.

@koic koic closed this as completed Oct 1, 2024
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

No branches or pull requests

2 participants