-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Inline in_batches
false-positive on Migration/BatchInBatches
#14
Comments
Thank you for your report! I completely forgot about that when I implemented it. Maybe if we improve in these lines, I think it will work also in inline calls: rubocop-migration/lib/rubocop/cop/migration/batch_in_batches.rb Lines 88 to 91 in 14c09ee
|
Maybe we should also use the inline style for autocorrection? # bad
User.update_all(some_column: 'some value')
# good
User.in_batches.update_all(some_column: 'some value') |
in_batches
false-positive on Migration/BatchInBatches
Added support for inline and also changed its autocorrection result to prefer the inline style over the block style at: |
Just published v0.5.0:
It was a good opportunity to improve |
Update works for all my test cases, and amazingly fast too! |
Model.where(field: nil).in_batches.update_all(field: false)
Gets flagged by the Migration/BatchInBatches cop, and auto-corrected to:
Please update the Migration/BatchInBatches cop to allow for the above inline usage of in_batches, as the correction is unnecessary and produces code with two consecutive in_batches calls.
The text was updated successfully, but these errors were encountered: