lib/job-iteration/enumerator_builder.rb
def build_active_record_enumerator_on_records(scope, cursor:, **args)
      enum = build_active_record_enumerator(
        scope,
        cursor: cursor,
        **args
      ).records
      wrap(self, enum)
    end
def build_active_record_enumerator_on_records(scope, cursor:, **args)
      enum = build_active_record_enumerator(
        scope,
        cursor: cursor,
        **args
      ).records
      wrap(self, enum)
    end
Builds Enumerator from Active Record Relation. Each Enumerator tick moves the cursor one row forward.

 +columns:+ argument is used to build the actual query for iteration. +columns+: defaults to primary key:

   1) SELECT * FROM users ORDER BY id LIMIT 100

 When iteration is resumed, +cursor:+ and +columns:+ values will be used to continue from the point
 where iteration stopped:

   2) SELECT * FROM users WHERE id > $CURSOR ORDER BY id LIMIT 100

 +columns:+ can also take more than one column. In that case, +cursor+ will contain serialized values
 of all columns at the point where iteration stopped.

 Consider this example with +columns: [:created_at, :id]+. Here's the query will use on the first iteration:

   1) SELECT * FROM `products` ORDER BY created_at, id LIMIT 100

 And the query on the next iteration:

   2) SELECT * FROM `products`
        WHERE (created_at > '$LAST_CREATED_AT_CURSOR'
          OR (created_at = '$LAST_CREATED_AT_CURSOR' AND (id > '$LAST_ID_CURSOR')))
        ORDER BY created_at, id LIMIT 100