-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bring in patch from Rails to expose public attr readers on BatchEnume…
…rator
- Loading branch information
1 parent
46b4f5c
commit 63ab1b1
Showing
3 changed files
with
28 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# frozen_string_literal: true | ||
|
||
# TODO: Remove this patch once all supported Rails versions include the changes | ||
# upstream - https://github.com/rails/rails/pull/42312/commits/a031a43d969c87542c4ee8d0d338d55fcbb53376 | ||
module ActiveRecordBatchEnumerator | ||
# The primary key value from which the BatchEnumerator starts, | ||
# inclusive of the value. | ||
attr_reader :start | ||
|
||
# The primary key value at which the BatchEnumerator ends, | ||
# inclusive of the value. | ||
attr_reader :finish | ||
|
||
# The relation from which the BatchEnumerator yields batches. | ||
attr_reader :relation | ||
|
||
# The size of the batches yielded by the BatchEnumerator. | ||
def batch_size | ||
@of | ||
end | ||
end | ||
|
||
ActiveRecord::Batches::BatchEnumerator.include(ActiveRecordBatchEnumerator) |