[LRUG] ActiveRecord::Relation#as_batches - like find_each but honours order, limit, offset
Daniel Barlow
dan at telent.net
Sat May 5 13:41:15 PDT 2012
On 5 May 2012 21:06, Christopher Patuzzo <chris.patuzzo at gmail.com> wrote:
> Is there a good reason for gemifying this rather than trying to get it into
> rails core? Seems like a valuable addition if you're able to get the
> existing find_each to respect order and limits.
Patches have been proposed in the past to enhance find_each this way,
but rejected as "wontfix": "This function is deliberately limited to
primary_key order because those values don't change. If you order by
title and manipulate the title in your block, you'll get nonsense /
repeated options back"
https://rails.lighthouseapp.com/projects/8994/tickets/2502-patch-arbase-reverse-find_in_batches
https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/2137-allow-find_batches-to-use-order-limit-and-offset#ticket-2137-2
I don't know if that's a *good* reason or if it's just taking the easy
way out, but that was the reason ...
-dan
--
dan at telent.net
http://ww.telent.net
More information about the Chat
mailing list