This project is archived and is in readonly mode.

#2260 ✓resolved
eric.tipton (at gmail)

find_in_batches updates (+2 bugs)

Reported by eric.tipton (at gmail) | March 16th, 2009 @ 09:50 PM | in 2.x

BUG 1: When given a :select that doesn't contain the primary key, this method will fail.

BUG 2: Method was calling in one spot (should be instance.send(primary_key))

requested updates -- I modified the method to: 1.) accept :limit and :offset 2.) accept :start_with_zero (defaults to true). If :start is NOT provided, this will cause method to look for primary_key >= 0 on first batch. If false, the method will do find(:first) to find the initial "start" value. If :start IS provided, this is not used at all. This allows non-integer primary keys to be used.

attached is my version of activerecord/lib/active_record/batches.rb containing the updates and bug fixes (the only method changed is find_in_batches)

I have not done extensive unit tests. Will post when I have done that.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>