I'm trying to figure out it there's some alternative to find(:all)
that can avoid instantiating every object at once, when I know that
I'm just going to iterate over the collection and throw it away. E.g.
def batch_process User.find(:all).each do |user| batch_process_one_user(user) end end
Unfortunately, this may instantiate millions of User objects and use
up GB of memory, which is not acceptable. I've been digging through
docs and code trying to figure out how I can do this within Rails,
rather than having to go down to the raw DB connection and build from
there, or pushing everything into a stored procedure.
Thanks,
-kevin