Skip to content
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

Fix batch methods for historical models #324

Merged
merged 1 commit into from
Aug 13, 2024
Merged

Commits on Aug 12, 2024

  1. 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
    tagliala committed Aug 12, 2024
    Configuration menu
    Copy the full SHA
    b7155a5 View commit details
    Browse the repository at this point in the history