-
Notifications
You must be signed in to change notification settings - Fork 125
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
Decorate ActiveRecord::Batches methods #1335
Conversation
Seeing some unrelated bundler step failures, eg:
|
@bdewater Rebasing |
@st0012 done! |
dc9927e
to
142fdbf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks it looks good to me. Few minor comments.
return_type: "T.nilable(T::Enumerable[T::Enumerable[#{constant_name}]])", | ||
) | ||
when :in_batches | ||
use_ranges = ActiveRecord::Batches.instance_method(:find_each).parameters.include?([:key, :use_ranges]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not related to this PR but it may be worth investing in a rails_helper
similar to https://github.com/Shopify/tapioca/blob/main/lib/tapioca/helpers/sorbet_helper.rb if these keep coming up. We had a similar occurrence in #1327.
ebe0605
to
9e4409a
Compare
Motivation
I wanted typing for the yielded values from the methods in https://github.com/rails/rails/blob/main/activerecord/lib/active_record/relation/batches.rb
Partially addresses #1281
Implementation
Mostly straightforward, return types are nilable in case the block form is used, eg:
Tests
Added tests.