We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
where
I discovered recently I could rewrite a manual scope comparing dates using Rails power directly.
For example:
Event.where('at >= ?', Time.current) # => "SELECT \"events\".* FROM \"events\" WHERE (at >= '2023-01-22 20:14:34.878368')" Event.where('at < ?', Time.current) # => "SELECT \"events\".* FROM \"events\" WHERE (at < '2023-01-22 20:14:34.878368')"
Event.where(at: Time.current..) # => "SELECT \"events\".* FROM \"events\" WHERE \"events\".\"at\" >= '2023-01-22 20:14:34.878368'" Event.where(at: ...Time.current) # => "SELECT \"events\".* FROM \"events\" WHERE \"events\".\"at\" < '2023-01-22 20:14:34.878368'"
In the same way, the cop should handle:
- `<` : `…Time.current` - `<=` : `..Time.current` - `>=` : `Time.current..` - `>` : `Time.current…` # seems to behave as `>=`
I haven’t seen any cop that could detect this, what do you think about adding a new rule to the gem ?
Thank you :)
Some related context from Rails repo: rails/rails#47054 (comment)
The text was updated successfully, but these errors were encountered:
Duplicate - #689 ?
Sorry, something went wrong.
Indeed, it seems a duplicate of #689
Thanks for the catch, will close this one 👍
No branches or pull requests
I discovered recently I could rewrite a manual scope comparing dates using Rails power directly.
For example:
Before
After
In the same way, the cop should handle:
I haven’t seen any cop that could detect this, what do you think about adding a new rule to the gem ?
Thank you :)
Some related context from Rails repo: rails/rails#47054 (comment)
The text was updated successfully, but these errors were encountered: