Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix batch methods for historical models
In the default implementation, `cursor` defaults to `primary_key`, which is 'id'. However, for historical models, we need to use 'hid' instead of 'id'. This patch addresses an issue where `with_hid_pkey` is called after the cursor is already set, potentially leading to incorrect behavior. Notes: - `find_each` and `find_in_batches` use `in_batches` internally, however this is not enough anymore in the upcoming Rails 8.0 because there is a conditional branch using `enum_for` - This approach prevents specifying 'id' as a cursor for historical models. If 'id' is needed, it must be handled separately. Fix #321
- Loading branch information